@@ -16,13 +16,15 @@ export class Outlet {
16
16
// in module that lazy loads children (loadChildren) and has outlet name.
17
17
outletKeys : Array < string > ;
18
18
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 > = [ ] ;
19
22
// The url path to the Outlet.
20
23
// E.G: the path to Outlet3 that is nested Outlet1(home)->Outlet2(nested1)->Outlet3(nested2)
21
24
// will be 'home/nested1'
22
25
path : string ;
23
26
pathByOutlets : string ;
24
27
states : Array < LocationState > = [ ] ;
25
- frame : Frame ;
26
28
27
29
// Used in reuse-strategy by its children to determine if they should be detached too.
28
30
shouldDetach : boolean = true ;
@@ -35,6 +37,10 @@ export class Outlet {
35
37
this . path = path ;
36
38
}
37
39
40
+ containsFrame ( frame : Frame ) : boolean {
41
+ return this . frames . indexOf ( frame ) > - 1 ;
42
+ }
43
+
38
44
peekState ( ) : LocationState {
39
45
if ( this . states . length > 0 ) {
40
46
return this . states [ this . states . length - 1 ] ;
@@ -244,7 +250,7 @@ export class NSLocationStrategy extends LocationStrategy {
244
250
const topmostFrame = this . frameService . getFrame ( ) ;
245
251
this . currentOutlet = this . getOutletByFrame ( topmostFrame ) ;
246
252
}
247
- this . currentOutlet . frame . goBack ( ) ;
253
+ this . currentOutlet . frames [ this . currentOutlet . frames . length - 1 ] . goBack ( ) ;
248
254
} else {
249
255
// Nested navigation - just pop the state
250
256
if ( isLogEnabled ( ) ) {
@@ -423,7 +429,9 @@ export class NSLocationStrategy extends LocationStrategy {
423
429
}
424
430
425
431
updateOutletFrame ( outlet : Outlet , frame : Frame ) {
426
- outlet . frame = frame ;
432
+ if ( ! outlet . containsFrame ( frame ) ) {
433
+ outlet . frames . push ( frame ) ;
434
+ }
427
435
this . currentOutlet = outlet ;
428
436
}
429
437
@@ -436,10 +444,10 @@ export class NSLocationStrategy extends LocationStrategy {
436
444
}
437
445
438
446
// Remove outlet from the url tree.
439
- if ( currentOutlet . frame === frame && ! isEqualToCurrent ) {
447
+ if ( currentOutlet . containsFrame ( frame ) && ! isEqualToCurrent ) {
440
448
this . callPopState ( null , true , currentOutlet ) ;
441
449
}
442
- return currentOutlet . frame !== frame ;
450
+ return ! currentOutlet . containsFrame ( frame ) ;
443
451
} ) ;
444
452
}
445
453
@@ -528,7 +536,7 @@ export class NSLocationStrategy extends LocationStrategy {
528
536
for ( let index = 0 ; index < this . outlets . length ; index ++ ) {
529
537
const currentOutlet = this . outlets [ index ] ;
530
538
531
- if ( currentOutlet . frame === frame ) {
539
+ if ( currentOutlet . containsFrame ( frame ) ) {
532
540
outlet = currentOutlet ;
533
541
break ;
534
542
}
0 commit comments