@@ -16,13 +16,15 @@ export class Outlet {
1616 // in module that lazy loads children (loadChildren) and has outlet name.
1717 outletKeys : Array < string > ;
1818
19+ // More than one frame available when using NSEmptyOutletComponent component
20+ // in module that lazy loads children (loadChildren) and has outlet name.
21+ frames : Array < Frame > = [ ] ;
1922 // The url path to the Outlet.
2023 // E.G: the path to Outlet3 that is nested Outlet1(home)->Outlet2(nested1)->Outlet3(nested2)
2124 // will be 'home/nested1'
2225 path : string ;
2326 pathByOutlets : string ;
2427 states : Array < LocationState > = [ ] ;
25- frame : Frame ;
2628
2729 // Used in reuse-strategy by its children to determine if they should be detached too.
2830 shouldDetach : boolean = true ;
@@ -35,6 +37,10 @@ export class Outlet {
3537 this . path = path ;
3638 }
3739
40+ containsFrame ( frame : Frame ) : boolean {
41+ return this . frames . indexOf ( frame ) > - 1 ;
42+ }
43+
3844 peekState ( ) : LocationState {
3945 if ( this . states . length > 0 ) {
4046 return this . states [ this . states . length - 1 ] ;
@@ -244,7 +250,7 @@ export class NSLocationStrategy extends LocationStrategy {
244250 const topmostFrame = this . frameService . getFrame ( ) ;
245251 this . currentOutlet = this . getOutletByFrame ( topmostFrame ) ;
246252 }
247- this . currentOutlet . frame . goBack ( ) ;
253+ this . currentOutlet . frames [ this . currentOutlet . frames . length - 1 ] . goBack ( ) ;
248254 } else {
249255 // Nested navigation - just pop the state
250256 if ( isLogEnabled ( ) ) {
@@ -423,7 +429,9 @@ export class NSLocationStrategy extends LocationStrategy {
423429 }
424430
425431 updateOutletFrame ( outlet : Outlet , frame : Frame ) {
426- outlet . frame = frame ;
432+ if ( ! outlet . containsFrame ( frame ) ) {
433+ outlet . frames . push ( frame ) ;
434+ }
427435 this . currentOutlet = outlet ;
428436 }
429437
@@ -436,10 +444,10 @@ export class NSLocationStrategy extends LocationStrategy {
436444 }
437445
438446 // Remove outlet from the url tree.
439- if ( currentOutlet . frame === frame && ! isEqualToCurrent ) {
447+ if ( currentOutlet . containsFrame ( frame ) && ! isEqualToCurrent ) {
440448 this . callPopState ( null , true , currentOutlet ) ;
441449 }
442- return currentOutlet . frame !== frame ;
450+ return ! currentOutlet . containsFrame ( frame ) ;
443451 } ) ;
444452 }
445453
@@ -528,7 +536,7 @@ export class NSLocationStrategy extends LocationStrategy {
528536 for ( let index = 0 ; index < this . outlets . length ; index ++ ) {
529537 const currentOutlet = this . outlets [ index ] ;
530538
531- if ( currentOutlet . frame === frame ) {
539+ if ( currentOutlet . containsFrame ( frame ) ) {
532540 outlet = currentOutlet ;
533541 break ;
534542 }
0 commit comments