に資金を供給している私はこのようなJSONを持っている:角度2ストップ* NgForかの特定の値が
[
{"Name": "xxxx", "country": "country1", etc...}
{"Name": "xxxx", "country": "country2", etc...}
{"Name": "xxxx", "country": "country1", etc...}
{"Name": "xxxx", "country": "country1", etc...}
]
...とコード:
<ng-container *ngFor="let contact of contacts">
<ng-container *ngIf="contact.country == 'country1'">
<div>COUNTRY1</div>
</ng-container></ng-container>
このコードはそれを見つけるたびにCOUNTRY1を作成します」 country1 " 国の値を一度印刷したいと思います。出来ますか?
データを国別に別の配列にグループ化し、ビュー内でこの配列を反復処理することができます。 – Zabavsky