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

Commit 80a2176

Browse files
Narretzpetebacondarwin
authored andcommitted
docs($compile): clarify scope types and controllerAs
Closes #12537 Closes #12758
1 parent 681affe commit 80a2176

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/ng/compile.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,10 @@
150150
*
151151
* * **falsy:** No scope will be created for the directive. The directive will use its parent's scope.
152152
*
153-
* * **`true`:** A new scope will be created for the directive's element. If multiple directives on the
154-
* same element request a new scope, only one new scope is created. The new scope rule does not apply
155-
* for the root of the template since the root of the template always gets a new scope.
153+
* * **`true`:** A new child scope that prototypically inherits from its parent will be created for
154+
* the directive's element. If multiple directives on the same element request a new scope,
155+
* only one new scope is created. The new scope rule does not apply for the root of the template
156+
* since the root of the template always gets a new scope.
156157
*
157158
* * **`{...}` (an object hash):** A new "isolate" scope is created for the directive's element. The
158159
* 'isolate' scope differs from normal scope in that it does not prototypically inherit from its parent
@@ -257,9 +258,10 @@
257258
*
258259
* #### `controllerAs`
259260
* Identifier name for a reference to the controller in the directive's scope.
260-
* This allows the controller to be referenced from the directive template. The directive
261-
* needs to define a scope for this configuration to be used. Useful in the case when
262-
* directive is used as component.
261+
* This allows the controller to be referenced from the directive template. This is especially
262+
* useful when a directive is used as component, i.e. with an `isolate` scope. It's also possible
263+
* to use it in a directive without an `isolate` / `new` scope, but you need to be aware that the
264+
* `controllerAs` reference might overwrite a property that already exists on the parent scope.
263265
*
264266
*
265267
* #### `restrict`

0 commit comments

Comments
 (0)