When did Angular install $ watch?

So, I am loading my page containing one directive.

<my-directive></my-directive>

I know that Angular will start compilation, then the controller, and then the link function for myDirective. When does Angular set a $ clock?

I assume that it will be configured during the controller, but then does that mean that the $ digest loop ends before the link function?

+4
source share
1 answer

You can set up $ watchers wherever you have access to the area. This includes ngController constructors, directory controllers, and link functions. However, a suitable place for this is the link function of the definition of the directive.

$watchers , (I.e. , )

+2

Source: https://habr.com/ru/post/1614676/


All Articles