JSON Example
{
"bloodTypes":[
{"Id":1, "Type":"O +", "Description":"Universal donor"},
{"Id":2, "Type":"AB +", "Description":"Universal recipient"}
],
"GenderOptions":[
{"Id":1, "Value":"Male", "Description":"M"},
{"Id":2, "Value":"Female", "Description":"F"}
]
}
Pipe Function:
transform(list: Lookup[], type: string): Lookup[] {
if (!list || !type || list.length === 0) {
return list;
}
return Array.of(list[type])
}
Auto-generated Lookup Class (from nswag):
export interface ILookupData {
name?: string | undefined;
value?: string | undefined;
description?: string | undefined;
}
HTML Snippet:
<option *ngFor="let option of list | lookupFilter:'GenderOptions'" [value]="option.Id">
{{option.Value}}
</option>
The select element is not connecting the necessary values. What could be causing this issue?