简体   繁体   English

Ionic-如何遍历JSON对象

[英]Ionic - How to loop over JSON Objects

I'm a dummy when it comes to Angular and I'm currently building a ionic app ( similar to Instagram ) for a school project. 在谈到Angular时,我是一个虚拟人,我目前正在为学校项目构建一个离子应用程序(类似于Instagram)。 I have HTML code that is ready to be filled with content from my Database. 我已经准备好用数据库中的内容填充HTML代码。 I have a provider set up and I managed to display a single title. 我设置了提供程序,并且设法显示了一个标题。 But now what I was wondering is how can I loop through all table entries to show all Posts in the same HTML format that I've written for posts. 但是,现在我想知道的是如何循环浏览所有表条目,以显示与我为帖子编写的HTML格式相同的所有帖子。 在此图像中,您可以看到当我执行console.log时,我的数据对象现在是什么样子

If anyone knows a good tut or anything please let me know! 如果有人知道一个很好的孩子,请告诉我!

To loop over Array: 要遍历数组:

<ul *ngFor="let item of data">
    <li>{{item.description}}</li>
</ul>

This will loop over your array. 这将遍历您的数组。

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

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