제 질문은 isolatedScope, $ scope, $ rootScope를 포함하여 아래 코드에 얼마나 많은 범위 요소가 포함되는지입니다.angleApp에 얼마나 많은 Scope가 있습니까?
그래서 외부ng-repeat
이
list.length
범위를 만들 것
ng-repeat
모든 행에 대한 새로운
scope
를 생성 이후
$rootScope
이 다음,
ExampleController
에서, 다음
컨트롤러 scope
이있을 것있을 것
<script>
angular.module('initExample', [])
.controller('ExampleController', ['$scope', function($scope) {
$scope.list = [['a', 'b'], ['c', 'd']];
}]);
</script>
<body ng-app="myApp">
<div ng-controller="ExampleController">
<div ng-repeat="innerList in list" ng-init="outerIndex = $index">
<div ng-repeat="value in innerList" ng-init="innerIndex = $index">
<span class="example-init">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>
</div>
</div>
</div>
</body>
는
ng-repeat 및 ng-init은 어떻게됩니까? – harsh