You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: docs/content/guide/scope.ngdoc
+20-11
Original file line number
Diff line number
Diff line change
@@ -109,12 +109,14 @@ to test the behavior without being distracted by the rendering details.
109
109
## Scope Hierarchies
110
110
111
111
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.
113
113
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.
118
120
119
121
When AngularJS evaluates `{{name}}`, it first looks at the scope associated with the given
120
122
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:
185
187
186
188
3. To retrieve the associated scope in console execute: `angular.element($0).scope()`
187
189
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>
188
193
189
194
## Scope Events Propagation
190
195
@@ -309,12 +314,16 @@ correctly.
309
314
310
315
In most cases, {@link ng.$compileProvider#directive directives} and scopes interact
311
316
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.
0 commit comments