问题
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