I make one application with IONIC-2 Beta version. I want to use for-each loop. is it possible to use for each in angular-V2?
Thanks.
I make one application with IONIC-2 Beta version. I want to use for-each loop. is it possible to use for each in angular-V2?
Thanks.
First in the
Component
, you have to declare the array you want to show:If you want to change the values in the code, you can do it by doing:
And then in your View you can print them like this:
Please notice that part
*ngFor="let data of displayData"
where:displayData
is the array we defined in theComponent
let data of ...
defines a new variable calleddata
, which represents each of the elements of thedisplayData
array.data
variable, and interpolation like{{ data.propertyName }}
.