简体   繁体   English

如何以角度在 UI 上显示 Json 数据?

[英]How to display Json data on UI in angular?

I am trying to display a json object in the UI.我正在尝试在 UI 中显示一个 json 对象。 I am able to show the json object but when I try to display the object inside the object, I am getting errors.我能够显示 json 对象,但是当我尝试在对象内显示该对象时,出现错误。 Please help me on this.请帮我解决这个问题。

您的描述不是很清楚,但为了解决标题问题,您可以使用<pre>元素和内置的 JSON 管道在 Angular 的 UI 中显示 JavaScript 对象的 JSON 表示,如下所示:

<pre>{{details | json}}</pre>

Solution :解决方案 :

{{details.nwedev.alldata.states.values.power}}

you probably have been accessing incorrectly to the value, try to log the json to make sure that field exist.您可能对值的访问不正确,请尝试记录 json 以确保该字段存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM