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

Commit c03abe7

Browse files
committed
docs($compile): clarify scope types and controllerAs
Closes #12537 Closes #12758
1 parent aa11dfc commit c03abe7

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Diff for: src/ng/compile.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,12 @@
146146
* and other directives used in the directive's template will also be excluded from execution.
147147
*
148148
* #### `scope`
149-
* **If set to `true`,** then a new scope will be created for this directive. If multiple directives on the
150-
* same element request a new scope, only one new scope is created. The new scope rule does not
151-
* apply for the root of the template since the root of the template always gets a new scope.
149+
* **If not defined, or if set to a `falsy` value**, the directive will use the parent scope.
150+
*
151+
* **If set to `true`,** then a new child scope will be created for this directive that prototypically
152+
* inherits from the parent scope. If multiple directives on the same element request a new scope,
153+
* only one new scope is created. The new scope rule does not apply for the root of the template
154+
* since the root of the template always gets a new scope.
152155
*
153156
* **If set to `{}` (object hash),** then a new "isolate" scope is created. The 'isolate' scope differs from
154157
* normal scope in that it does not prototypically inherit from the parent scope. This is useful
@@ -238,9 +241,10 @@
238241
*
239242
* #### `controllerAs`
240243
* Identifier name for a reference to the controller in the directive's scope.
241-
* This allows the controller to be referenced from the directive template. The directive
242-
* needs to define a scope for this configuration to be used. Useful in the case when
243-
* directive is used as component.
244+
* This allows the controller to be referenced from the directive template. This is especially
245+
* useful when a directive is used as component, i.e. with an `isolate` scope. It's also possible
246+
* to use it in a directive without an `isolate` / `new` scope, but you need to be aware that the
247+
* `controllerAs` reference might overwrite a property that already exists on the parent scope.
244248
*
245249
*
246250
* #### `restrict`

0 commit comments

Comments
 (0)