Hi I am having below array where I need to show only codes in dropdown where status:active I tried using ngif in options tag like *ngIf="c.status=='Active'"
but not working how to show only active objects.
<select class="form-control" [(ngModel)]="addproduct.code">
<option *ngFor="let c of allProducts" [value]="c.code" id="{{c.code}}">{{ c.code }}</option>
</select>
In component :
getAllProducts(){
this.superuserViewAccountpreferencessService.getProductDetails().subscribe(
res => {
this.allProducts = res['products'];
}
)
}
i will get response as:
[{
"code": "PLATINUM",
"status": "Active",
"cost": 100
}, {
"code": "PlatinumTe",
"cost": 123
}, {
"code": "Test11",
"cost": 1234
}, {
"code": "PLATINUM22",
"status": "Active",
"cost": 1000
}]