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

Commit 2f667b1

Browse files
committed
docs(guide/scopes): mention component directive scopes, reorder info
Closes #15634
1 parent 07f34e7 commit 2f667b1

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

docs/content/guide/scope.ngdoc

+20-11
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,14 @@ to test the behavior without being distracted by the rendering details.
109109
## Scope Hierarchies
110110

111111
Each AngularJS application has exactly one {@link ng.$rootScope root scope}, but
112-
may have several child scopes.
112+
may have any number of child scopes.
113113

114-
The application can have multiple scopes, because some {@link guide/directive directives} create
115-
new child scopes (refer to directive documentation to see which directives create new scopes).
116-
When new scopes are created, they are added as children of their parent scope. This creates a tree
117-
structure which parallels the DOM where they're attached.
114+
The application can have multiple scopes, because {@link guide/directive directives} can create new
115+
child scopes. When new scopes are created, they are added as children of their parent scope. This
116+
creates a tree structure which parallels the DOM where they're attached.
117+
118+
The section {@link guide/scope#directives-that-create-scopes Directives that Create Scopes} has more
119+
info about which directives create scopes.
118120

119121
When AngularJS evaluates `{{name}}`, it first looks at the scope associated with the given
120122
element for the `name` property. If no such property is found, it searches the parent scope
@@ -185,6 +187,9 @@ To examine the scope in the debugger:
185187

186188
3. To retrieve the associated scope in console execute: `angular.element($0).scope()`
187189

190+
<div class="alert alert-warning">
191+
The `scope()` function is only available when {@link ng.$compileProvider#debugInfoEnabled `$compileProvider.debugInfoEnabled()`} is true (which is the default).
192+
</div>
188193

189194
## Scope Events Propagation
190195

@@ -309,12 +314,16 @@ correctly.
309314

310315
In most cases, {@link ng.$compileProvider#directive directives} and scopes interact
311316
but do not create new instances of scope. However, some directives, such as {@link
312-
ng.directive:ngController ng-controller} and {@link
313-
ng.directive:ngRepeat ng-repeat}, create new child scopes
314-
and attach the child scope to the corresponding DOM element. You can retrieve a scope for any DOM
315-
element by using an `angular.element(aDomElement).scope()` method call.
316-
See the {@link guide/directive#isolating-the-scope-of-a-directive
317-
directives guide} for more information about isolate scopes.
317+
ng.directive:ngController ng-controller} and {@link ng.directive:ngRepeat ng-repeat},
318+
create new child scopes and attach the child scope to the corresponding DOM element.
319+
320+
A special type of scope is the `isolate` scope, which does not inherit prototypically from the parent scope.
321+
This type of scope is useful for component directives that should be isolated from their parent scope.
322+
See the {@link guide/directive#isolating-the-scope-of-a-directive directives guide} for
323+
more information about isolate scopes in custom directives.
324+
325+
Note also that component directives, which are created with the
326+
{@link api/ng/type/angular.Module#component .component()} helper always create an isolate scope.
318327

319328
### Controllers and Scopes
320329

0 commit comments

Comments
 (0)