56
56
*
57
57
* Every application has a single root {@link ng.$rootScope.Scope scope}.
58
58
* All other scopes are child scopes of the root scope. Scopes provide mechanism for watching the model and provide
59
- * event processing life- cycle. See {@link guide/scope developer guide on scopes}.
59
+ * event processing life cycle. See {@link guide/scope developer guide on scopes}.
60
60
*/
61
61
function $RootScopeProvider ( ) {
62
62
var TTL = 10 ;
@@ -152,9 +152,9 @@ function $RootScopeProvider(){
152
152
* the scope and its child scopes to be permanently detached from the parent and thus stop
153
153
* participating in model change detection and listener notification by invoking.
154
154
*
155
- * @param {boolean } isolate if true then the scope does not prototypically inherit from the
155
+ * @param {boolean } isolate If true, then the scope does not prototypically inherit from the
156
156
* parent scope. The scope is isolated, as it can not see parent scope properties.
157
- * When creating widgets it is useful for the widget to not accidentally read parent
157
+ * When creating widgets, it is useful for the widget to not accidentally read parent
158
158
* state.
159
159
*
160
160
* @returns {Object } The newly created child scope.
@@ -167,12 +167,12 @@ function $RootScopeProvider(){
167
167
if ( isolate ) {
168
168
child = new Scope ( ) ;
169
169
child . $root = this . $root ;
170
- // ensure that there is just one async queue per $rootScope and it's children
170
+ // ensure that there is just one async queue per $rootScope and its children
171
171
child . $$asyncQueue = this . $$asyncQueue ;
172
172
child . $$postDigestQueue = this . $$postDigestQueue ;
173
173
} else {
174
174
Child = function ( ) { } ; // should be anonymous; This is so that when the minifier munges
175
- // the name it does not become random set of chars. These will then show up as class
175
+ // the name it does not become random set of chars. This will then show up as class
176
176
// name in the debugger.
177
177
Child . prototype = this ;
178
178
child = new Child ( ) ;
@@ -202,7 +202,7 @@ function $RootScopeProvider(){
202
202
* Registers a `listener` callback to be executed whenever the `watchExpression` changes.
203
203
*
204
204
* - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest $digest()} and
205
- * should return the value which will be watched. (Since {@link ng.$rootScope.Scope#$digest $digest()}
205
+ * should return the value that will be watched. (Since {@link ng.$rootScope.Scope#$digest $digest()}
206
206
* reruns when it detects changes the `watchExpression` can execute multiple times per
207
207
* {@link ng.$rootScope.Scope#$digest $digest()} and should be idempotent.)
208
208
* - The `listener` is called only when the value from the current `watchExpression` and the
@@ -313,13 +313,13 @@ function $RootScopeProvider(){
313
313
*
314
314
* @description
315
315
* Shallow watches the properties of an object and fires whenever any of the properties change
316
- * (for arrays this implies watching the array items, for object maps this implies watching the properties).
317
- * If a change is detected the `listener` callback is fired.
316
+ * (for arrays, this implies watching the array items; for object maps, this implies watching the properties).
317
+ * If a change is detected, the `listener` callback is fired.
318
318
*
319
319
* - The `obj` collection is observed via standard $watch operation and is examined on every call to $digest() to
320
320
* see if any items have been added, removed, or moved.
321
- * - The `listener` is called whenever anything within the `obj` has changed. Examples include adding new items
322
- * into the object or array, removing and moving items around .
321
+ * - The `listener` is called whenever anything within the `obj` has changed. Examples include adding, removing,
322
+ * and moving items belonging to an object or array .
323
323
*
324
324
*
325
325
* # Example
@@ -356,8 +356,8 @@ function $RootScopeProvider(){
356
356
* `oldCollection` object is a copy of the former collection data.
357
357
* The `scope` refers to the current scope.
358
358
*
359
- * @returns {function() } Returns a de-registration function for this listener. When the de-registration function is executed
360
- * then the internal watch operation is terminated.
359
+ * @returns {function() } Returns a de-registration function for this listener. When the de-registration function
360
+ * is executed, the internal watch operation is terminated.
361
361
*/
362
362
$watchCollection : function ( obj , listener ) {
363
363
var self = this ;
@@ -458,18 +458,17 @@ function $RootScopeProvider(){
458
458
* firing. This means that it is possible to get into an infinite loop. This function will throw
459
459
* `'Maximum iteration limit exceeded.'` if the number of iterations exceeds 10.
460
460
*
461
- * Usually you don't call `$digest()` directly in
461
+ * Usually, you don't call `$digest()` directly in
462
462
* {@link ng.directive:ngController controllers} or in
463
463
* {@link ng.$compileProvider#directive directives}.
464
- * Instead a call to {@link ng.$rootScope.Scope#$apply $apply()} (typically from within a
465
- * {@link ng.$compileProvider#directive directives}) will force a `$digest()`.
464
+ * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within a
465
+ * {@link ng.$compileProvider#directive directives}), which will force a `$digest()`.
466
466
*
467
467
* If you want to be notified whenever `$digest()` is called,
468
- * you can register a `watchExpression` function with {@link ng.$rootScope.Scope#$watch $watch()}
468
+ * you can register a `watchExpression` function with {@link ng.$rootScope.Scope#$watch $watch()}
469
469
* with no `listener`.
470
470
*
471
- * You may have a need to call `$digest()` from within unit-tests, to simulate the scope
472
- * life-cycle.
471
+ * In unit tests, you may need to call `$digest()` to simulate the scope life cycle.
473
472
*
474
473
* # Example
475
474
* <pre>
@@ -610,8 +609,8 @@ function $RootScopeProvider(){
610
609
* {@link ng.directive:ngRepeat ngRepeat} for managing the
611
610
* unrolling of the loop.
612
611
*
613
- * Just before a scope is destroyed a `$destroy` event is broadcasted on this scope.
614
- * Application code can register a `$destroy` event handler that will give it chance to
612
+ * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope.
613
+ * Application code can register a `$destroy` event handler that will give it a chance to
615
614
* perform any necessary cleanup.
616
615
*
617
616
* Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to
@@ -643,7 +642,7 @@ function $RootScopeProvider(){
643
642
* @function
644
643
*
645
644
* @description
646
- * Executes the `expression` on the current scope returning the result. Any exceptions in the
645
+ * Executes the `expression` on the current scope and returns the result. Any exceptions in the
647
646
* expression are propagated (uncaught). This is useful when evaluating Angular expressions.
648
647
*
649
648
* # Example
@@ -678,19 +677,19 @@ function $RootScopeProvider(){
678
677
*
679
678
* The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only that:
680
679
*
681
- * - it will execute after the function that schedule the evaluation is done running (preferably before DOM rendering).
680
+ * - it will execute after the function that scheduled the evaluation (preferably before DOM rendering).
682
681
* - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after `expression` execution.
683
682
*
684
683
* Any exceptions from the execution of the expression are forwarded to the
685
684
* {@link ng.$exceptionHandler $exceptionHandler} service.
686
685
*
687
- * __Note:__ if this function is called outside of `$digest` cycle, a new $digest cycle will be scheduled.
688
- * It is however encouraged to always call code that changes the model from withing an `$apply` call.
686
+ * __Note:__ if this function is called outside of a `$digest` cycle, a new ` $digest` cycle will be scheduled.
687
+ * However, it is encouraged to always call code that changes the model from within an `$apply` call.
689
688
* That includes code evaluated via `$evalAsync`.
690
689
*
691
690
* @param {(string|function())= } expression An angular expression to be executed.
692
691
*
693
- * - `string`: execute using the rules as defined in {@link guide/expression expression}.
692
+ * - `string`: execute using the rules as defined in {@link guide/expression expression}.
694
693
* - `function(scope)`: execute the function with the current `scope` parameter.
695
694
*
696
695
*/
@@ -721,7 +720,7 @@ function $RootScopeProvider(){
721
720
* @description
722
721
* `$apply()` is used to execute an expression in angular from outside of the angular framework.
723
722
* (For example from browser DOM events, setTimeout, XHR or third party libraries).
724
- * Because we are calling into the angular framework we need to perform proper scope life- cycle
723
+ * Because we are calling into the angular framework we need to perform proper scope life cycle
725
724
* of {@link ng.$exceptionHandler exception handling},
726
725
* {@link ng.$rootScope.Scope#$digest executing watches}.
727
726
*
@@ -790,7 +789,7 @@ function $RootScopeProvider(){
790
789
*
791
790
* - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or `$broadcast`-ed.
792
791
* - `currentScope` - `{Scope}`: the current scope which is handling the event.
793
- * - `name` - `{string}`: Name of the event.
792
+ * - `name` - `{string}`: name of the event.
794
793
* - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel further event
795
794
* propagation (available only for events that were `$emit`-ed).
796
795
* - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag to true.
@@ -833,7 +832,7 @@ function $RootScopeProvider(){
833
832
*
834
833
* @param {string } name Event name to emit.
835
834
* @param {...* } args Optional set of arguments which will be passed onto the event listeners.
836
- * @return {Object } Event object, see {@link ng.$rootScope.Scope#$on}
835
+ * @return {Object } Event object ( see {@link ng.$rootScope.Scope#$on}).
837
836
*/
838
837
$emit : function ( name , args ) {
839
838
var empty = [ ] ,
0 commit comments