Skip to content

Commit 7bc1e9b

Browse files
committed
docs($compile): add docs for bindToController with object hash
Closes angular#13228 Closes angular#13625
1 parent be03fd1 commit 7bc1e9b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/ng/compile.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,22 @@
212212
*
213213
*
214214
* #### `bindToController`
215-
* When an isolate scope is used for a component (see above), and `controllerAs` is used, `bindToController: true` will
215+
* This property can be used to bind scope properties directly to the controller. It can be either
216+
* `true` or an object hash with the same format as the `scope` property. Additionally,
217+
* `controllerAs` must be used for it to work.
218+
*
219+
* When an isolate scope is used for a component (see above), `bindToController: true` will
216220
* allow a component to have its properties bound to the controller, rather than to scope. When the controller
217221
* is instantiated, the initial values of the isolate scope bindings are already available.
218222
*
223+
* It is also possible to set `bindToController` to an object hash with the same format as the `scope` property.
224+
* This will set up the scope bindings to the controller directly. Note that `scope` can still be used
225+
* to define which kind of scope is created. By default, no scope is created. Use `{}` to create an isolate
226+
* scope (useful for component directives).
227+
*
228+
* If both `bindToController` and `scope` are defined and have object hashes, `bindToController` overrides `scope`.
229+
*
230+
*
219231
* #### `controller`
220232
* Controller constructor function. The controller is instantiated before the
221233
* pre-linking phase and can be accessed by other directives (see

0 commit comments

Comments
 (0)