新手以angularjs.trying显示来自json嵌套对象的数据,如此
我的HTML代码是
<a rel="extranal" data-val="<%rcds%>" ng-repeat="rcds in rcd" class="international" id="<%rcds.id%>">
<span><img ng-src="<% rcds.routes.subroutes %>"/> <% rcds.subroutes[0].xyz%></span>
<div class="departure-time"><% rcds.subroutes[0].abc %></div>
</a>
希望根据json.how中legtype的条件在ng-repeat中显示数据子路由。
答案 0 :(得分:1)
如果你想把你的对象显示为JSON,你唯一需要写的是{{rcds | json}}
否则,如果您想要导航嵌套对象,您应该执行以下操作:
<div ng-repeat="rcds in red">
<div ng-repeat="route in rcds.routes">
<!-- route element --->
<div ng-repeat="depart in route.depart">
<!-- depart element --->
<div ng-repeat="subroute in route.subroutes">
<!-- subroute element -->
</div>
</div>
</div>
</div>