Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 36b2bba

Browse files
RichardLittbtford
authored andcommittedJun 4, 2014
docs(guide/directive): explain controllerAs option
There was nothing about controllerAs in the developer guide. Helps #6710 and #6759
1 parent 45fed49 commit 36b2bba

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎docs/content/guide/directive.ngdoc

+5
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,11 @@ So where does this `myTabs` controller come from? Directives can specify control
901901
the unsurprisingly named `controller` option. As you can see, the `myTabs` directive uses this
902902
option. Just like `ngController`, this option attaches a controller to the template of the directive.
903903

904+
If it is necessary to reference the controller or any functions bound to the controller's scope in
905+
the template, you can use the option `controllerAs` to specify the name of the controller as an alias.
906+
The directive needs to define a scope for this configuration to be used. This is particularly useful
907+
in the case when the directive is used as a component.
908+
904909
Looking back at `myPane`'s definition, notice the last argument in its `link` function: `tabsCtrl`.
905910
When a directive requires a controller, it receives that controller as the fourth argument of its
906911
`link` function. Taking advantage of this, `myPane` can call the `addPane` function of `myTabs`.

0 commit comments

Comments
 (0)