use variable to call ngFor in Ionic2

Asked

Viewed 115 times

0

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

In the example code:

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

Where it is written cardapiohotrod I would like to put the variable {{date.}}

  • Managed to solve your problem? I don’t understand the error. If you can put more parts of the code help.

1 answer

0

Brother, ngFor serves to loop. in arrays for example, so it will take the positions of the array. More if you want to display 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 could not loop it because it contains only one value.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.