diff --git a/docs/content/guide/directive.ngdoc b/docs/content/guide/directive.ngdoc index 47c38d5fb450..328485f5f58f 100644 --- a/docs/content/guide/directive.ngdoc +++ b/docs/content/guide/directive.ngdoc @@ -587,14 +587,24 @@ want to reuse throughout your app. In this example we will build a directive that displays the current time. Once a second, it updates the DOM to reflect the current time. -Directives that want to modify the DOM typically use the `link` option. -`link` takes a function with the following signature, `function link(scope, element, attrs) { ... }` -where: +Directives that want to modify the DOM typically use the `link` option to register DOM listeners +as well as update the DOM. It is executed after the template has been cloned and is where +directive logic will be put. + + `link` takes a function with the following signature, +`function link(scope, element, attrs, controller, transcludeFn) { ... }`, where: * `scope` is an Angular scope object. * `element` is the jqLite-wrapped element that this directive matches. * `attrs` is a hash object with key-value pairs of normalized attribute names and their corresponding attribute values. +* `controller` is the directive's required controller instance(s) or it's own controller (if any). + The exact value depends on the directive's require property. +* `transcludeFn` is a transclude linking function pre-bound to the correct transclusion scope. + +
+For full detail on the `link` method refer to the {@link ng.$compile#-link- `$compile` API} page. +
In our `link` function, we want to update the displayed time once a second, or whenever a user changes the time formatting string that our directive binds to. We will use the `$interval` service @@ -997,7 +1007,7 @@ angular.module('docsTabsExample', []) scope: { title: '@' }, - link: function(scope, element, attrs, controllers) { + link: function(scope, element, attrs, controllers, transcludeFn) { var tabsCtrl = controllers[0], modelCtrl = controllers[1];