I have an array of words consisting of 2, 3, 4, 5 and so on letter words.
im using an ng-For to iterate through the array and ng-if to display the words according to the amount of letters but i cant seem to get a title in to separate them
expected outcome
2 letter words
to am as .......
3 letter words
the bee sin .......
and so on,
this is what i have so far
<div *ngIf="data">
<h2 class="title">{{data.letters}}</h2>
<ul class="wordList" *ngFor="let item of data.word">
<li *ngIf="item.length ==2">{{item}}</li>
<li *ngIf="item.length ==3">{{item}}</li>
<li *ngIf="item.length ==4">{{item}}</li>
<li *ngIf="item.length ==5">{{item}}</li>
<li *ngIf="item.length ==6">{{item}}</li>
<li *ngIf="item.length ==7">{{item}}</li>
<li *ngIf="item.length ==8">{{item}}</li>
<li *ngIf="item.length ==9">{{item}}</li>
<li *ngIf="item.length ==10">{{item}}</li>
<li *ngIf="item.length ==11">{{item}}</li>
<li *ngIf="item.length ==12">{{item}}</li>
<li *ngIf="item.length ==13">{{item}}</li>
<li *ngIf="item.length ==14">{{item}}</li>
</ul>
</div>
i know i should also be using an index to iterate through the sized words, ill get to that after :)
question from:
https://stackoverflow.com/questions/65865963/how-to-display-a-h2-once-using-ngfor-and-ngif 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…