|
218 | 218 | * definition: `controller: 'myCtrl as myAlias'`.
|
219 | 219 | *
|
220 | 220 | * When an isolate scope is used for a directive (see above), `bindToController: true` will
|
221 |
| - * allow a component to have its properties bound to the controller, rather than to scope. When the controller |
222 |
| - * is instantiated, the initial values of the isolate scope bindings will be available if the controller is not an ES6 class. |
| 221 | + * allow a component to have its properties bound to the controller, rather than to scope. |
| 222 | + * |
| 223 | + * After the controller is instantiated, the initial values of the isolate scope bindings will bound to the controller |
| 224 | + * properties. You can access these bindings once they have been initialized by providing a controller method called |
| 225 | + * `$onInit`, which is called after all the controllers on an element have been constructed and had their bindings |
| 226 | + * initialized. |
| 227 | + * |
| 228 | + * <div class="alert alert-warning"> |
| 229 | + * **Deprecation warning:** although bindings for non-ES6 class controllers are currently |
| 230 | + * bound to `this` before the controller constructor is called, this use is now deprecated. Please place initialization |
| 231 | + * code that relies upon bindings inside a `$onInit` method on the controller, instead. |
| 232 | + * </div> |
223 | 233 | *
|
224 | 234 | * It is also possible to set `bindToController` to an object hash with the same format as the `scope` property.
|
225 | 235 | * This will set up the scope bindings to the controller directly. Note that `scope` can still be used
|
|
255 | 265 | * The `$transclude` function also has a method on it, `$transclude.isSlotFilled(slotName)`, which returns
|
256 | 266 | * `true` if the specified slot contains content (i.e. one or more DOM nodes).
|
257 | 267 | *
|
| 268 | + * The controller can provide the following methods that act as life-cycle hooks: |
| 269 | + * * `$onInit` - Called on each controller after all the controllers on an element have been constructed and |
| 270 | + * had their bindings initialized. This is a good place to put initialization code for your controller. |
| 271 | + * |
258 | 272 | * #### `require`
|
259 | 273 | * Require another directive and inject its controller as the fourth argument to the linking function. The
|
260 | 274 | * `require` takes a string name (or array of strings) of the directive(s) to pass in. If an array is used, the
|
|
0 commit comments