javascript - element.ready vs angular.element($document).ready -
i working on directive don't want play $document or $window, element itself.
before had:
angular.element($document).ready(function() {...}); and working, few minutes ago changed, , put:
element.ready(function() {...}); and working also.
so, when element.ready(function() {...}) telling angular run function when element <my-directive></my-directive> ready? or doing?
i asking because wondering, why still working if element.ready instead.
you don't need either.
ready isn't needed since element has exist link function fire. there no element level ready event ... used @ document level account full body of page existing. stage long on when angular compiling directives.
you can manipulation or event binding directly element within link function of directive
Comments
Post a Comment