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

docs(): clarify scope types and controllerAs #12758

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/ng/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,10 @@
*
* * **falsy:** No scope will be created for the directive. The directive will use its parent's scope.
*
* * **`true`:** A new scope will be created for the directive's element. If multiple directives on the
* same element request a new scope, only one new scope is created. The new scope rule does not apply
* for the root of the template since the root of the template always gets a new scope.
* * **`true`:** A new child scope that prototypically inherits from its parent will be created for
* the directive's element. If multiple directives on the same element request a new scope,
* only one new scope is created. The new scope rule does not apply for the root of the template
* since the root of the template always gets a new scope.
*
* * **`{...}` (an object hash):** A new "isolate" scope is created for the directive's element. The
* 'isolate' scope differs from normal scope in that it does not prototypically inherit from its parent
Expand Down Expand Up @@ -257,9 +258,10 @@
*
* #### `controllerAs`
* Identifier name for a reference to the controller in the directive's scope.
* This allows the controller to be referenced from the directive template. The directive
* needs to define a scope for this configuration to be used. Useful in the case when
* directive is used as component.
* This allows the controller to be referenced from the directive template. This is especially
* useful when a directive is used as component, i.e. with an `isolate` scope. It's also possible
* to use it in a directive without an `isolate` / `new` scope, but you need to be aware that the
* `controllerAs` reference might overwrite a property that already exists on the parent scope.
*
*
* #### `restrict`
Expand Down