AngularJs 中 ng-repeat 嵌套问题

做一个二级导航菜单,从数据库读取数据显示到前台
数据库表结构为
nodeid 节点ID
nodedesc 节点描述
parentnodeid 父节点ID
nodeindex 节点索引
nodelink 节点连接url

js代码很简单,从数据库获取导航菜单数据


var app = angular.module("indexApp",[])
.controller("indexController", ["$scope", "$http", function ($scope, $http) {
	$http({
		url:'./Handler/GetNavigateHandler.ashx',
		method:'GET'
	}).success(function(data,header,config,status){
		$scope.navdata = data;
                console.table(data);
	}).error(function(data,header,config,status){
	      console.log(data);
	});
}]);

这个是控制台查看的从数据库获取的数据
在这里插入图片描述

前台展示代码


<ul class="nav navbar-nav" ng-repeat="item in navdata |  filter : {parentnodeid : '0'} | orderBy : 'nodeid'">
  	<li class="dropdown">
		<a class="dropdown-toggle"  href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
			{{item.nodedesc}}
			<span class="caret"></span>
		</a>
		<ul class="dropdown-menu" ng-repeat="subitem in navdata | filter : {parentnodeid : item.nodeid} | orderBy : 'nodeindex'">
			<li><a href="#">{{subitem.nodedesc}}</a></li>
		</ul>
	</li>
</ul>   
				

下面是我实际开发中遇到的一个table的案例

<tr ng-repeat="x in settlementSheet.items|hideDeleted|filter:itemFilter"

	<td class="text-center no-padding" 
    	    ng-repeat="y in currentWaybillList|filter : {docEntry : x.waybillNum}">
          <span ng-bind="y.settlementNotes"/>
	</td>
</tr>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章