post link vs pre link in Angular js directives
As outlined here:
http://docs.angularjs.org/guide/directive
Angular js directives take two different types of link functions:
Pre-linking function Executed before the child elements are linked. Not
safe to do DOM transformation since the compiler linking function will
fail to locate the correct elements for linking.
Post-linking function Executed after the child elements are linked. It is
safe to do DOM transformation in the post-linking function.
Additionally, it appears that the default key of link will bind to
postLink if given an anonymous function.
When and why would I ever want to use a pre link function?
No comments:
Post a Comment