1
我正在使用JSON API与Angular 4前端,现在我试图显示这个JSON Object的数据。如何拆分角4中的JSON对象4
我用下面的代码:
<div *ngFor="let Questionnaire of struc.data">
<span>{{Questionnaire.attributes.content.headline}}</span><br>
<span>{{Questionnaire.attributes.content.text}}</span><br>
<span>{{Questionnaire.attributes.content.question}}</span>
</div>
<div *ngFor="let Questionnaire of struc.data">
<li>{{Questionnaire.attributes.content.answers}}</li>
</div>
它的工作原理,但我得到我的答案格式为:
- überhauptnicht,Sehr泽尔滕,einige男,häufig,sehrhäufig
而不是看起来像这样:
- überhauptnicht
- Sehr泽尔滕
- einige男
- häufig
- sehrhäufig
这有什么错我的代码?
我做了,但我得到了这个错误:无法读取属性'拆分'未定义..我认为它是因为我正在处理数组而不是字符串,因为我的JSON对象,我只是不知道如何改变这个 – betterel
检查更新的答案 – Sajeetharan
真棒!这工作。非常感谢! – betterel