When using highchart in the command, an error of 245 was reported. The error content was illegal invocation and digest. The loop reached the upper limit. The code is as follows
.directive('highchart',function($timeout){
return{
restrict:'E',
template:'<p></p>',
scope:{
config:'='
},
link:function(scope, ele, attr) {
var handle;
scope.$watch('config',function(cfg){
if(handle){
$timeout.cancel(handle);
}
handle = $timeout(function(){
console.log(ele.find('p'),scope.config)
ele.find('p').highcharts(scope.config)
},250)
})
}
}
})
No error was reported when I called the log variable in the chrome console. Where did the highchart action trigger the angular loop
The problem lies in the object, just copy the object
I think it should be scope.$watch() in your link