javascript - angularJS triggers click event and reports $rootScope:inprog error
巴扎黑
巴扎黑 2017-07-05 10:35:55
0
2
858

I wrote a table in angularJS, and then found a piece of code on the Internet to export the data to excel. JavaScript is OK, but when I put the code into angular,

this error will be reported when the click event is triggered

, I checked online and found that the error was reported because there were multiple $ executions. Others were caused by $apply in angular, but how could the JavaScript click event cause such an error? I'm really confused, please give me some advice...

巴扎黑
巴扎黑

reply all(2)
迷茫

Wrap the code that calls the click event with setTimeout() and try it

Ty80

There is $timeout inside angularjs
First inject $timeout into your controller
$timeout(function() {

  ...    // 执行你的click代码

});

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template