JSON
{
"bloodGroup":[
{"Id":1, "Value":"O +ve", "Description":"OPositive"},
{"Id":2, "Value":"O -ve", "Description":"ONegative"},
{"Id":3, "Value":"AB +ve", "Description":"ABPositive"}
],
"Gender":[
{"Id":1, "Value":"Male", "Description":"Male"},
{"Id":2, "Value":"Female", "Description":"Female"}
]
}
Pipe:
transform(aList: Lookup[], lookUpName: string): Lookup[] {
if (!aList || !lookUpName || aList.length === 0) {
return aList;
}
return Array.of(aList[lookUpName])
}
Lookup Class (autogenerated from nswag):
export interface ILookup {
name?: string | undefined;
value?: string | undefined;
description?: string | undefined;
}
HTML:
<option *ngFor="let gender of aList | lookupFilter:'Gender'" [value]="gender.Id">
{{gender.Value}}
</option>
The select doesn't bind the required values. What am i doing wrong?
lookupFilter. cannot it used as<option *ngFor="let gender of aList.Gender" [value]="gender.Id">{{gender.Value}}</option>