0
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
</head>
<body>
<div ng-app="myApp" ng-controller="customersCtrl">
<button ng-click="call('d')">for d</button>
<button ng-click="call('f')">for f</button>
<ul>
<li ng-repeat="x in a[replace]">{{ngController}}
{{x}}<div><input ng-model=well ng-click=fun()>{{well}}</div>
</li>
</ul>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope) {
$scope.a = {
d:[1,2,3,4,5],
f:[6,7,8,9]
};
$scope.call = function(val) {
$scope.replace=val;
}
});
</script>
</body>
</html>
這裏的範圍值,我給NG-範圍,目前正在重複。現在我想訪問這些特定的範圍。我怎樣才能做到這一點?
我們怎麼可以參考各範圍,因爲所有範圍屬於同一個控制器和範圍的名稱是相同的所有迭代的值(它會改變,如何像數組???),它的工作原理是什麼? – Abhishek
轉到有角度的官方文檔,你會飛到那裏。 這個答案適合你嗎? –