The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Compile Pre and Post Link

Compile Pre and Post Link

1:53
The typical function you use when creating a directive is the **post link** function with the signature `function (scope, element, attributes) {}`. You can also make use of the **pre link** function for finer grained control of the initialization of your directive.
Watch this lesson now
Avatar
egghead.io

The typical function you use when creating a directive is the post link function with the signature function (scope, element, attributes) {}. You can also make use of the pre link function for finer grained control of the initialization of your directive.

Avatar
Giovanni

Hi, John
I found this example very illuminating, however I want to go one step further.
I modified it a bit to see what happens when you have two directives in the same element (with different priorities). Check it out here http://jsfiddle.net/gkbonetti/tY72y/3.
Something weird happened (in my opinion). The parent post-link is not waiting for all its children anymore. It happens straight after the directive with higher priority.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?