Set ID to ion-toggle


#1

In one of my pages I tried this to set a dynamic ID to each element of the list:

    <ion-list>
      <ion-item *ngFor="let element of elements" #item>
        {{element.name}}
        <ion-icon name="add" ></ion-icon>
        <input  class="text-center" id="{{element.ID}}" >
        <ion-icon name="remove" ></ion-icon>
      </ion-item>
    </ion-list>

I set the ID in this line:

<input class="text-center" id="{{element.ID}}">

But if I try this with ion-toggle it doesn’t work:

    <ion-list>
      <ion-item *ngFor="let element of mant" #item>
        <ion-label color="holiday">{{element.name}}</ion-label>
        <ion-toggle   id="{{element.ID}}" color="holiday"></ion-toggle>
      </ion-item>
    </ion-list>

This is an example of the output that I’m getting:


#2

I was trying in:

toggle.nativeElement.id

But it was in:

toggle._gesture.element.id