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
Post a Comment