javascript - Angular Directive addEventListener with ng-repeat -


i have directive adds few event listeners element in link function.

e.g.:

... link: function(scope, element) {     // gives native js object     var el = element[0];      el.draggable = true;      el.addeventlistener('dragstart', ...); } ... 

now use directive inside of ng-repeat. question is, make new eventlistener each element inside of ng-repeat ?

if so, have 100 items within ng-repeat, cause performance problems ?

if so, changes make attach elements same event listener ?

yes, add event each element in ng-repeat. directives executed 1 time per element have attached.the listener not cause major performance issues. (no more ng-repeat, not performant)


Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -