This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +25
-7
lines changed Expand file tree Collapse file tree 2 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -1040,17 +1040,22 @@ function $RootScopeProvider() {
10401040 $apply : function ( expr ) {
10411041 try {
10421042 beginPhase ( '$apply' ) ;
1043- return this . $eval ( expr ) ;
1044- } catch ( e ) {
1045- $exceptionHandler ( e ) ;
1046- } finally {
1047- clearPhase ( ) ;
10481043 try {
1049- $rootScope . $digest ( ) ;
1044+ return this . $eval ( expr ) ;
10501045 } catch ( e ) {
10511046 $exceptionHandler ( e ) ;
1052- throw e ;
1047+ } finally {
1048+ clearPhase ( ) ;
1049+ try {
1050+ $rootScope . $digest ( ) ;
1051+ } catch ( e ) {
1052+ $exceptionHandler ( e ) ;
1053+ throw e ;
1054+ }
10531055 }
1056+ } catch ( e ) {
1057+ $exceptionHandler ( e ) ;
1058+ throw e ;
10541059 }
10551060 } ,
10561061
Original file line number Diff line number Diff line change @@ -1505,6 +1505,19 @@ describe('Scope', function() {
15051505 } ) ) ;
15061506
15071507
1508+ it ( 'should not clear the state when calling $apply during an $apply' , inject (
1509+ function ( $rootScope ) {
1510+ $rootScope . $apply ( function ( ) {
1511+ expect ( function ( ) {
1512+ $rootScope . $apply ( ) ;
1513+ } ) . toThrowMinErr ( '$rootScope' , 'inprog' , '$apply already in progress' ) ;
1514+ expect ( function ( ) {
1515+ $rootScope . $apply ( ) ;
1516+ } ) . toThrowMinErr ( '$rootScope' , 'inprog' , '$apply already in progress' ) ;
1517+ } ) ;
1518+ } ) ) ;
1519+
1520+
15081521 it ( 'should throw an exception if $apply is called while flushing evalAsync queue' , inject (
15091522 function ( $rootScope ) {
15101523 expect ( function ( ) {
You can’t perform that action at this time.
0 commit comments