File tree 2 files changed +8
-0
lines changed
2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,7 @@ function $RootScopeProvider(){
196
196
// ensure that there is just one async queue per $rootScope and its children
197
197
child . $$asyncQueue = this . $$asyncQueue ;
198
198
child . $$postDigestQueue = this . $$postDigestQueue ;
199
+ child . $on ( '$destroy' , function ( ) { child . $$destroyed = true ; } ) ;
199
200
} else {
200
201
// Only create a child scope class if somebody asks for one,
201
202
// but cache it to allow the VM to optimize lookups.
Original file line number Diff line number Diff line change @@ -994,6 +994,13 @@ describe('Scope', function() {
994
994
expect ( log ) . toBe ( '123' ) ;
995
995
} ) ) ;
996
996
997
+ it ( 'should broadcast the $destroy only once' , inject ( function ( $rootScope , log ) {
998
+ var isolateScope = first . $new ( true ) ;
999
+ isolateScope . $on ( '$destroy' , log . fn ( 'event' ) ) ;
1000
+ first . $destroy ( ) ;
1001
+ isolateScope . $destroy ( ) ;
1002
+ expect ( log ) . toEqual ( 'event' ) ;
1003
+ } ) ) ;
997
1004
998
1005
it ( 'should decrement ancestor $$listenerCount entries' , inject ( function ( $rootScope ) {
999
1006
var EVENT = 'fooEvent' ,
You can’t perform that action at this time.
0 commit comments