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

Commit afd0807

Browse files
committed
docs($compile): clarify link fn's controller argument
Also add "bindToController" to exampe directive definition object. Closes #10815
1 parent 6a6f403 commit afd0807

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/ng/compile.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
* scope: false,
7777
* controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... },
7878
* controllerAs: 'stringIdentifier',
79+
* bindToController: false,
7980
* require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],
8081
* compile: function compile(tElement, tAttrs, transclude) {
8182
* return {
@@ -395,9 +396,15 @@
395396
* * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared
396397
* between all directive linking functions.
397398
*
398-
* * `controller` - a controller instance - A controller instance if at least one directive on the
399-
* element defines a controller. The controller is shared among all the directives, which allows
400-
* the directives to use the controllers as a communication channel.
399+
* * `controller` - the directive's required controller instance(s) - Instances are shared
400+
* among all directives, which allows the directives to use the controllers as a communication
401+
* channel. The exact value depends on the directive's `require` property:
402+
* * `string`: the controller instance
403+
* * `array`: array of controller instances
404+
* * no controller(s) required: `undefined`
405+
*
406+
* If a required controller cannot be found, and it is optional, the instance is `null`,
407+
* otherwise the {@link error:$compile:ctreq Missing Required Controller} error is thrown.
401408
*
402409
* * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.
403410
* This is the same as the `$transclude`

0 commit comments

Comments
 (0)