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

Commit abfbfd6

Browse files
committed
docs($compile): clarify link fn's controller argument
Also add "bindToController" to exampe directive definition object. Closes #10815 Conflicts: src/ng/compile.js
1 parent a0e91c4 commit abfbfd6

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/ng/compile.js

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

0 commit comments

Comments
 (0)