From 5f827819418bc2b6157e97bf35c2c6ea93835518 Mon Sep 17 00:00:00 2001 From: Martin Staffa Date: Fri, 4 Sep 2015 13:24:53 +0200 Subject: [PATCH] docs($compile): clarify scope types and controllerAs Closes #12537 Closes #12758 --- src/ng/compile.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ng/compile.js b/src/ng/compile.js index d21cf401e763..d60c670ee80f 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -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 @@ -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`