Arco Voltaico
Arco Voltaico

Reputation: 814

Angular NativeScript visibility not binding 2 ways

I got this view:

 <ng-template let-item="item" let-i="index">
 <GridLayout rows="*" columns="100, *" (tap)="select(item.id)">
<Label [text]="'this is :'+ item.id + ' and selected is ' + model.selectedItem"></Label>
      <Button text="Send" [visibility]="item.id == model.selectedItem? 'visible' : 'collapsed'"></Button>

When I tap the row, my function select() is updating OK the model.selectedItem to the item.id, in fact the Label text is updated fine. But the Button visibility is never being updated to visible so I can't see it.

I even tried to apply the same logic to [class] instead of [visibility] and use the visibility as a tag on css, but again, no luck. The visibility attribute is not being updated ....

Any idea? Thx !

Upvotes: 0

Views: 240

Answers (1)

Ferhatos
Ferhatos

Reputation: 73

Use *ngIf :

*ngIf="item.id===model.selectedItem"

Upvotes: 0

Related Questions