Angular Bootstrap Modal Slow ng-repeat in Google Chrome

点点圈 提交于 2019-12-24 06:44:46

问题


I'm using the $modal in Angular Bootstrap UI and have run into a performance issue in Google Chrome only. I have an ng-repeat directive inside of my modal instance, and am binding it to 300 rows, and it's pegging my processor and locking up the browser for seconds. This only happens in Google Chrome. I tried it in Firefox and the same code works fine. Here's a plunker that illustrates the problem - if you open this in Chrome I suspect that you'll see the issue as well.

Am I doing something wrong here? Why is this so taxing on the CPU when executed in Chrome as opposed to Firefox? Using the same HTML and JavaScript WITHOUT the Bootstrap modal works just fine in Chrome, so it must be something related to Bootstrap?


回答1:


Like other comment I have no problem on my laptop in Chrome (win 64, Chrome 31)

But you have 900+ watchers on the modal scope (see : http://plnkr.co/edit/LIOAzVI4hACROqXlhICq?p=preview)

You should maybe take a look at bindonce module to speed things up on low CPU devices



来源:https://stackoverflow.com/questions/24038779/angular-bootstrap-modal-slow-ng-repeat-in-google-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!