Link Function And $watch() Callback Timing In AngularJS Directives

Each one of these directives logs the link() function and the $watch() function execution so you can see how scopes affect the order in which different blocks of code will run.