Это мой plunkr: http://plnkr.co/edit/x6CIVJDCrWp4HkZy?preview
Я вижу эту ошибку только в версии 1.7.x, когда я возвращаюсь к версии 1.6.x, я не вижу этого ошибка.
Это мое приложение. js и я определил компонент home.
angular.module('myApp', [])
.component('home', {
templateUrl: 'test.html',
bindings: {
def: '<'
},
controller: function() {
var $ctrl = this;
console.log($ctrl);
this.user = {name: 'world'};
}
});
В тесте. html, у меня просто есть этот код
<h1>
Test
</h1>
Это код в HTML, когда я объявляю компонент home и использую array.concat для pu sh в массив, я вижу бесконечную ошибку дайджеста. Если я не использую array.concat, он работает нормально.
<home def="{
options: [{key: 'home', label: 'Home'}].concat([{key: 'home', label: 'Home'}])
}">
</home>
Даже этот код выдает ту же самую бесконечную ошибку дайджеста.
<home def="{
options: [
{key: 'home', label: 'Home', attribute: $ctrl.user || []}]}">
</home>
Это ошибка из консоли.
angular.js:15536 Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: [[{"msg":"fn: fn","newVal":{"options":["...","..."]},"oldVal":{"options":["...","..."]}}],[{"msg":"fn: fn","newVal":{"options":["...","..."]},"oldVal":"..."}],[{"msg":"fn: fn","newVal":{"options":["...","..."]},"oldVal":"..."}],[{"msg":"fn: fn","newVal":{"options":["...","..."]},"oldVal":"..."}],[{"msg":"fn: fn","newVal":{"options":["...","..."]},"oldVal":"..."}]]
https://errors.angularjs.org/1.7.5/$rootScope/infdig?p0=10&p1=%5B%5B%7B%22msg%22%3A%22fn%3A%20fn%22%2C%22newVal%22%3A%7B%22options%22%3A%5B%22...%22%2C%22...%22%5D%7D%2C%22oldVal%22%3A%7B%22options%22%3A%5B%22...%22%2C%22...%22%5D%7D%7D%5D%2C%5B%7B%22msg%22%3A%22fn%3A%20fn%22%2C%22newVal%22%3A%7B%22options%22%3A%5B%22...%22%2C%22...%22%5D%7D%2C%22oldVal%22%3A%22...%22%7D%5D%2C%5B%7B%22msg%22%3A%22fn%3A%20fn%22%2C%22newVal%22%3A%7B%22options%22%3A%5B%22...%22%2C%22...%22%5D%7D%2C%22oldVal%22%3A%22...%22%7D%5D%2C%5B%7B%22msg%22%3A%22fn%3A%20fn%22%2C%22newVal%22%3A%7B%22options%22%3A%5B%22...%22%2C%22...%22%5D%7D%2C%22oldVal%22%3A%22...%22%7D%5D%2C%5B%7B%22msg%22%3A%22fn%3A%20fn%22%2C%22newVal%22%3A%7B%22options%22%3A%5B%22...%22%2C%22...%22%5D%7D%2C%22oldVal%22%3A%22...%22%7D%5D%5D
at angular.js:138
at Scope.$digest (angular.js:19143)
at Scope.$apply (angular.js:19463)
at done (angular.js:13312)
at completeRequest (angular.js:13569)
at XMLHttpRequest.requestLoaded (angular.js:13474)