I'm having a Json data model from that i want to fetch the data and add it into a select box as my drop down items. While doing that I'm facing difficulties to fetch the data to the select box . Iterations are working fine. but the whole Json array is getting printed. I want only my 3 Major Headings to be get printed.
Error Message:-ERROR Error: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.
I'm adding my sample Json and expected output also
Expected Output
LEED V4 BD+C LEED V4 ID+C LEED V4 EBOM
Sample Json
{
"Ratings": {
"LEED V4 BD+C": [{
}],
"LEED V4 ID+C": [{
}],
"LEED V4 EBOM": [{
}]
}
}
app.ts
template: `
<div class="col-md-6 form-group">
<label class="control-label">Rating System <span style="color: #2196f3;">*</span></label>
<select class="form-control" id="productparameter" *ngFor="let item of ratings.Ratings" >
<option value="">Select Rating</option>
<option value="">{{item}}</option>
</select>
</div>
`,
})
export class App {
public ratings: any ={
"Ratings": {
"LEED V4 BD+C": [{
}],
"LEED V4 ID+C": [{
}],
"LEED V4 EBOM": [{
}]
}
}
constructor( ) {
console.log( this.ratings.Ratings);
}
adding my plunker link :-https://plnkr.co/edit/pgbeS9iRkAzgWVNrLNQJ?p=preview
