在此創建的嵌套ng-repeat.Now中,我需要將第一個ng-repeat
id值傳遞給內部ng-repeat
。我怎麼能傳遞val.id
在內ng-repeat
如何在ng-repeat中傳遞動態範圍值
我的表
<table>
<tr ng-repeat="val in sample">
<td>
<table>
<tr>
<td>{{val.id}}</td>
<td>{{val.name}}</td>
</tr>
<tr ng-repeat="new_val in new_sample{{val.id}}">
<td>
<table>
<tr>
<td>{{new_val .new_id}}</td>
<td>{{new_val .new_name}}</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
我的腳本
var myApp = angular.module("myApp", []);
myApp.controller("MyController", function MyController($scope){
$scope.sample = [
{'id' : '1','name' : 'jon'},
{'id' : '2','name' : 'albert'}
];
$scope.new_sample1 = [
{'id' : '11','name' : 'jon1'},
{'id' : '22','name' : 'albert1'}
];
$scope.new_sample2 = [
{'id' : '111','name' : 'jon2'},
{'id' : '222','name' : 'albert2'}
];
});
感謝U Buddy它的工作:-) – Pravin
這是我的榮幸:) – Vineet