File tree 2 files changed +11
-4
lines changed
2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,8 @@ function createScope(providers, instanceCache) {
101
101
* {@link angular.service.$exceptionHandler $exceptionHandler} service.
102
102
* 3. The {@link angular.scope.$watch watch} listeners are fired immediately after
103
103
* the expression was executed using the {@link angular.scope.$digest $digest()} method.
104
- * 4. Finally the update of the DOM is scheduled using the
104
+ * 4. The `{@link angular.service.$defer $burp queue} with deferred tasks is flushed.
105
+ * 5. Finally the update of the DOM is scheduled using the
105
106
* {@link angular.service.$updateView $updateView} service (see step #6) The `$updateView`
106
107
* may merge multiple requests, that are close time-wise, into a single update.
107
108
* 6. The {@link angular.service.$updateView $updateView} service then fires DOM
@@ -842,6 +843,7 @@ Scope.prototype = {
842
843
$exceptionHandler(e);
843
844
} finally {
844
845
$root.$digest();
846
+ $defer.flush('$burp');
845
847
$updateView();
846
848
}
847
849
}
@@ -860,6 +862,7 @@ Scope.prototype = {
860
862
this . $service ( '$exceptionHandler' ) ( e ) ;
861
863
} finally {
862
864
this . $root . $digest ( ) ;
865
+ this . $service ( '$defer' ) . flush ( '$burp' ) ;
863
866
this . $service ( '$updateView' ) ( ) ;
864
867
}
865
868
}
Original file line number Diff line number Diff line change @@ -439,9 +439,10 @@ describe('Scope', function(){
439
439
var log = '' ;
440
440
var child = root . $new ( ) ;
441
441
root . $watch ( 'a' , function ( scope , a ) { log += '1' ; } ) ;
442
- root . $observe ( 'a' , function ( scope , a ) { log += '2' ; } ) ;
442
+ root . $observe ( 'a' , function ( scope , a ) { log += '3' ; } ) ;
443
+ root . $service ( '$defer' ) ( '$burp' , function ( ) { log += '2' ; } ) ;
443
444
child . $apply ( '$parent.a=0' ) ;
444
- expect ( log ) . toEqual ( '12 ' ) ;
445
+ expect ( log ) . toEqual ( '123 ' ) ;
445
446
} ) ;
446
447
447
448
@@ -464,8 +465,11 @@ describe('Scope', function(){
464
465
log = '' ;
465
466
$exceptionHandler = jasmine . createSpy ( '$exceptionHandler' ) ;
466
467
$updateView = jasmine . createSpy ( '$updateView' ) ;
468
+ $defer = { flush : jasmine . createSpy ( '$defer.flush' ) } ;
467
469
root . $service = function ( name ) {
468
- return { $updateView :$updateView , $exceptionHandler :$exceptionHandler } [ name ] ;
470
+ return { $updateView :$updateView ,
471
+ $exceptionHandler :$exceptionHandler ,
472
+ $defer :$defer } [ name ] ;
469
473
} ;
470
474
root . $watch ( function ( ) { log += '$digest;' ; } ) ;
471
475
log = '' ;
You can’t perform that action at this time.
0 commit comments