angular-ui / ui-tinymce

AngularUI wrapper for TinyMCE
MIT License
488 stars 371 forks source link

Use $digest instead of $apply to avoid unnecessary rootscope digest #204

Closed kobber closed 8 years ago

kobber commented 8 years ago

The scope.$apply call inside updateView triggers a digest cycle on the rootscope and all descending child scopes. This can cause unnecessary performance issues in large applications, because the scope of the entire application will be re-evaluated whenever a change occurs in the editor.

I suggest changing $apply to $digest, limiting the digest cycle to the directives own scope, and preventing it from affecting the surrounding application.

deeg commented 8 years ago

Thanks for posting and that all makes sense.

I just want to verify everything is still working tonight, and I will get this merged in.