this is my app.component.ts
@Component({
selector: 'my-app',
template: `<h1>{{title}}</h1>
{{test | json}}
<div ngFor='let test of tests' style='border: solid 1px'>
<div>
<P>
writer: {{test.A.B.C.D.writerid}} <br>
content:{{test}}<br>
write_date:{{test}}</P>
</div>
</div>
`,
})
public test: any[] = [
{
'A': {
'B': [{
'C': {
'D': [{
'content': 'content_test1',
'writedt': '2017-02-08 00:00:00',
'writerid': 'writerid_test1'
}, {
'content': 'content_test2',
'writedt': '2017-02-08 00:00:00',
'writerid': 'writerid_test1'
}, {
'content': 'content_test3',
'writedt': '2017-02-08 00:00:00',
'writerid': 'writerid_test2'
}, {
'content': 'content_test4',
'writedt': '2017-02-08 00:00:00',
'writerid': 'writerid_test2'
}]
}
}]
}
}
];
test.A.B.C.D.writerid is not working error:Cannot read property 'B' of undefined i don't understand why error is not A but B how can i access D's content or writedt or writerid