Skip to content Skip to sidebar Skip to footer

Functionality Of Angular Directive Before Return And Compile Chain

It is possible to run javascript in a directive before returning anything, as well as in a directive's compile step before returning anything: angular.module('foo').directive('

Solution 1:

  1. You would want to do this so you can have some private method definitions that only your object can use.

  2. You would want to do this if you were utilizing some service precompile to get the data for the directive, and post compile to use the data and do something with it.

  3. No idea

  4. I think there is some weird bubbling going on.

  5. because you only have two instances of your directive.

This is what I see in the console log:

before returncompilecompile
controller 
pre 
post 
controller 
pre 
post 

Post a Comment for "Functionality Of Angular Directive Before Return And Compile Chain"