angularjs - Why does using wrap inside directive compile function cause infinite loop? -
i trying utilize wrap
function within compile
function of directive
.
the next cause infinite loop , crash browser:
function compiler(telement, tattrs, transcludefn) { var wrapper = angular.element('<div />'); telement.wrap(wrapper); homecoming linker; }
why happening?
i'll guess... first time compiler
function called, wraps element (i.e., element in html set directive attribute) within new <div></div>. angular treats new element , compiles it... finds directive, calls compiler function again, wraps again, , angular treats new element... advertisement infinitum.
angularjs angularjs-directive
No comments:
Post a Comment