在Angularjs递归调用 [英] Recursive calling in Angularjs
本文介绍了在Angularjs递归调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新来Angulrajs,我想列出html页面的JSON对象。我觉得我必须去到对象递归。有没有可以在Angularjs做任何事情。
I am new to Angulrajs and I want to list a JSON object in html page. I think I have to go into the object recursively. Is there any thing that can be done in Angularjs.
我有嵌套的对象。所以,我必须去成说。
I have nested objects. So, I have to go into that.
推荐答案
You're going to use ng-repeat to loop over your object. Like this.
<ul>
<li ng-repeat="stuff in things"> stuff </li>
</ul>
*你的编辑之后。你认为你必须使用递归,因为你已经嵌套对象。这并不完全正确。您可以使用多个NG-重复。事情是这样的。
*after your edit. You think you have to use recursion because you have nested objects. That's not entirely true. You could use multiple ng-repeats. Something like this.
<div>
<div ng-repeat="stuff in things">
<span> stuff </span>
<div ng-repeat="morestuff in stuff">
moreStuff
</div>
</div>
这篇关于在Angularjs递归调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文