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>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章