use variable to call ngFor on Ionic2

0

I have a variable that I display on the screen of my app called {{data.reference}}.

In the sample code:

<ion-item *ngFor="let cardapiohotrod of cardapiohotrod | async">{{cardapiohotrod.nome}}</ion-item>

Where cardapiohotrod is written I'd like to put the variable {{data.reference}}

    
asked by anonymous 28.06.2017 / 06:50

1 answer

0

Brother, ngFor is for looping. in arrays, for example, because it will take the positions of the array. More if you want to show the content if there is value in the variable. you can use: * ngIf or [hidden] ... etc

From what I see this variable is an array position already. in this case you would not be able to loop in it as it contains only one value.

    
01.02.2018 / 15:21