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 +8
-0
lines changed
Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,7 @@ function $RootScopeProvider(){
196196 // ensure that there is just one async queue per $rootScope and its children
197197 child . $$asyncQueue = this . $$asyncQueue ;
198198 child . $$postDigestQueue = this . $$postDigestQueue ;
199+ child . $on ( '$destroy' , function ( ) { child . $$destroyed = true ; } ) ;
199200 } else {
200201 // Only create a child scope class if somebody asks for one,
201202 // 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() {
994994 expect ( log ) . toBe ( '123' ) ;
995995 } ) ) ;
996996
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+ } ) ) ;
9971004
9981005 it ( 'should decrement ancestor $$listenerCount entries' , inject ( function ( $rootScope ) {
9991006 var EVENT = 'fooEvent' ,
You can’t perform that action at this time.
0 commit comments