@@ -587,15 +587,24 @@ want to reuse throughout your app.
587
587
In this example we will build a directive that displays the current time.
588
588
Once a second, it updates the DOM to reflect the current time.
589
589
590
- Directives that want to modify the DOM typically use the `link` option, which is documented on the {@link ng.$compile `$compile` API} page.
591
- `link` takes a function with the following signature, `function link(scope, element, attrs, controller, transcludeFn) { ... }`, where:
590
+ Directives that want to modify the DOM typically use the `link` option to register DOM listeners
591
+ as well as update the DOM. It is executed after the template has been cloned and is where
592
+ directive logic will be put.
593
+
594
+ `link` takes a function with the following signature,
595
+ `function link(scope, element, attrs, controller, transcludeFn) { ... }`, where:
592
596
593
597
* `scope` is an Angular scope object.
594
598
* `element` is the jqLite-wrapped element that this directive matches.
595
599
* `attrs` is a hash object with key-value pairs of normalized attribute names and their
596
600
corresponding attribute values.
597
- * `controller` is the controller for the directive, if defined.
598
- * `transcludeFn` is a transclude linking function pre-bound to the correct translusion scope.
601
+ * `controller` is the directive's required controller instance(s) or it's own controller (if any).
602
+ The exact value depends on the directive's require property.
603
+ * `transcludeFn` is a transclude linking function pre-bound to the correct transclusion scope.
604
+
605
+ <div class="alert alert-info">
606
+ For full detail on the `link` method refer to the {@link ng.$compile `$compile` API} page.
607
+ </div>
599
608
600
609
In our `link` function, we want to update the displayed time once a second, or whenever a user
601
610
changes the time formatting string that our directive binds to. We will use the `$interval` service
0 commit comments