3 ms·
I use jQuery to speed up specific Angular controllers with lots of binding. The jQuery allows me to avoid the bindings on things like lists entirely. I create a
by mozey 12y ago
I use jQuery to speed up specific Angular controllers with lots of binding. The jQuery allows me to avoid the bindings on things like lists entirely. I create a companion directive to my controller with isolate scope. The two then communicate via events. Or the directive just calls the controllers functions from the child scope. Inside the directive I can render the list using something like Mustache, Handlebars, PureJS, etc. All of them seem to be faster than Angular by a factor of 10. Using the jQuery I can then bind, for example, one click handler to the entire list.
I load jQuery after Angular. This means Angular is still using jqLite - and prevents the extra functionality from being abused in simpler use-cases.
Sometime in the future browsers will support Object.observe natively. At this point I will scrap my companion directives and use Angular binding even in long lists.