Trying to set "disabled" attribute for item using index in *nfFor loop

hi there,

i have a list that is created looping over an object with a ngfor loop i also create an index and i would like to disable some child items programatically.

    <ion-item *ngFor="let item of item_set; let i=index">

now when i do this

<button [disabled]="setDisabled(i)" >

and in my .ts

setDisabled(i){
	return i==0;
}

it works.

however, when i try this:

<button disabled="{{( i==0 )}}" >

the button is always disabled even though the expression {{( i==0 )}} shows correctly as true or false in a textlabel

is this a bug or do i have a misunderstanding in angular syntax?

thanks!

1 Like