I have stored values in two arrays to iterate in a single ion-list . Billerstatusstate and Billerstatusnamelst are the two arrays.
I have tried the following to iterate
<ion-list ion-item *ngFor="let stat of Billerstatusstate;let bil of Billerstatusnamelst " >
{{bil}} <button round>{{stat}}</button>
</ion-list>
and
<ion-list ion-item *ngFor="let stat of Billerstatusstate" *ngFor="let bil of Billerstatusnamelst " >
{{bil}} <button round>{{stat}}</button>
</ion-list>
Its taking first iterated value for both local variable.
Is there something am i missing ??
is there anyother way to store both values in single array and split it in View side using ngFor..
I have followed this approach.. I have stored values in single array instead of two arrays as it comes from a single source.
In HTML part
Its worked for me..
I could create a pipe to "merge" your two arrays into a single one and then you can iterate over this new array.
Here is a sample:
And use it this way:
Multiple array in single array am using
single array code
how can i call in html using *ngfor
Why instead of doing this
don't you create a single
array
in your code:And then in your page:
You can leverage the index of the
ngFor
directive to achieve this.