[
{
"id":1,
"name":"Ashiz",
"email":"[email protected]",
"message":"How are you yankee\r\n",
"created_at":"2017-05-24 03:16:53",
"updated_at":"2017-05-24 03:16:53"
}
]
.map(res => res.json());
While i use json data, in above way, than it works fine . That i can use json data but when i use this way as object only than i got error. why? what is the differences between square bracket and without square bracket how to work with this?
{
"id":1,
"name":"Ashiz",
"email":"[email protected]",
"message":"How are you yankee\r\n",
"created_at":"2017-05-24 03:16:53",
"updated_at":"2017-05-24 03:16:53"
}
[]is an array or an iterable and{}is an object with key-value pairs.ngForneeds an iterable..*ngFor, you can just show the properties with e.g{{objectNameHere?.name}}notice the safe navigation operator: angular.io/docs/ts/latest/guide/…