I have a json array and i want to print the values in a simple list. How to print the values? Do I have to follow key value method? I'm adding my Json array structure and my sample code. It is showing me errors.
Expected Output
*456
*123
or Arun :123
test:456
Error:
"'[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.
Error: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays."
Json Array
{
"records": [{
"arun": [1, 2, 3],
"test": [4, 5, 6]
}]
}
**myTest.ts**
export class HomePageComponent extends AppComponent {
public bundle: any[];
ngOnInit(){
this.readArray();
}
readArray() {
this.bundle = {
"records": [{
"arun": [1, 2, 3],
"test": [4, 5, 6]
}]
}
console.log("array",this.bundle);
}
testComponent.html
<ul *ngFor="let det of bundle;">
<li>{{det.records}}</li>
</ul>