誰も、角度2のドロップダウンリストでレポート結果をフィルタリングする方法を知っていますか?私は現在、テンプレート* ngFor内でそれをやろうとしていますが、運がありません。カスタムパイプも試してみます。データはJSON配列からのものです。私だけにしようとしています以下のオブジェクトでは、「国営事業体」角2は、ドロップダウンの繰り返しをフィルタアウトします
マイデータオブジェクト
items[
{
"currentBUName":"Financial Services"
}
{
"currentBUName":"State Owned Entities"
}
{
"currentBUName":"State Owned Entities"
}
]
マイTSコードエキス
<ion-item>
<ion-label>Please select current business unit</ion-label>
<ion-select [(ngModel)]="selectedValue">
<ion-option *ngFor="let indexx of this.items;"[value]="indexx">{{indexx.currentBUName}}</ion-option>
</ion-select>
</ion-item>
返答ありがとうございますが、最終的にはこの関数を使用しました。このリンクからYoav Schniedermanにハンクします。transform()は、このリンクからYoav Schniedermanに渡します。http://stackoverflow.com/questions/41867448/in-angular2-ngfor-iteration-how-do-i-output-only-unique-values-from-the-array { if(this.items!== undefined && this.items!== null){ console.log(_。uniqBy(this.items、 'currentBUName'))); this.currentBUvals = _.uniqBy(this.items、 'currentBUName'); 戻り値_.uniqBy(this.items、 'currentBUName'); } これを返す。アイテム。 } ' – eohdev