接收数据
$scope.$watch("build.idx", ->
$http.get("/build/" + $scope.build.idx + ".json").success((data) ->
$scope.build = data
)
)
ng-include 在 ng-repeat 中
.build-stage
.row{ "ng-repeat" => "stage in build.stages" }
%div{ "ng-include" => "donoting.html" } # donoting.html is blank
第一个加载页面,就OK了。并且在更改 build.idx 时,它会导致
10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: [["fn: function (){var a=d.url(),b=h.$$replace;p&&a==h.absUrl()||(p++,c.$evalAsync(function(){c.$broadcast(\"$locationChangeStart\",h.absUrl(),a).defaultPrevented?h.$$parse(a):(d.url(h.absUrl(),b),g(a))}));h.$$replace=!1;return p}; newVal: 8; oldVal: 7"],["fn: function (){var a=d.url(),b=h.$$replace;p&&a==h.absUrl()||(p++,c.$evalAsync(function(){c.$broadcast(\"$locationChangeStart\",h.absUrl(),a).defaultPrevented?h.$$parse(a):(d.url(h.absUrl(),b),g(a))}));h.$$replace=!1;return p}; newVal: 9; oldVal: 8"],["fn: function (){var a=d.url(),b=h.$$replace;p&&a==h.absUrl()||(p++,c.$evalAsync(function(){c.$broadcast(\"$locationChangeStart\",h.absUrl(),a).defaultPrevented?h.$$parse(a):(d.url(h.absUrl(),b),g(a))}));h.$$replace=!1;return p}; newVal: 10; oldVal: 9"],["fn: function (){var a=d.url(),b=h.$$replace;p&&a==h.absUrl()||(p++,c.$evalAsync(function(){c.$broadcast(\"$locationChangeStart\",h.absUrl(),a).defaultPrevented?h.$$parse(a):(d.url(h.absUrl(),b),g(a))}));h.$$replace=!1;return p}; newVal: 11; oldVal: 10"],["fn: function (){var a=d.url(),b=h.$$replace;p&&a==h.absUrl()||(p++,c.$evalAsync(function(){c.$broadcast(\"$locationChangeStart\",h.absUrl(),a).defaultPrevented?h.$$parse(a):(d.url(h.absUrl(),b),g(a))}));h.$$replace=!1;return p}; newVal: 12; oldVal: 11"]]
并且在删除 ng-include 行时,没关系。我认为这是 ng-include 导致 $locationChangeStart 被解雇,但为什么呢?