ng-init function works in directive’s controller than in link function

I came across this when i am writing custom directives for my app.I am trying to fire a function using ng-init in the following way in directive template.

<div ng-init = “myfunc()”></div>

I wrote  myfunc()  in link function, it did not work.But it worked in controller.Since the controller runs before/at time of  compilation and link runs after compilation of directive.Its good to use link function for dom manipulations like binding events to directive elements and adding/removing html data. Controller is good at handling scope related things like accessing functions and isolated scope variables of directive.