@@ -58,13 +58,13 @@ export interface LocationState {
58
58
59
59
@Injectable ( )
60
60
export class NSLocationStrategy extends LocationStrategy {
61
- private outlets : Array < Outlet > = [ ] ;
62
61
private currentOutlet : Outlet ;
63
62
64
63
private popStateCallbacks = new Array < ( _ : any ) => any > ( ) ;
65
64
private _currentNavigationOptions : NavigationOptions ;
66
65
private currentUrlTree : UrlTree ;
67
66
67
+ public outlets : Array < Outlet > = [ ] ;
68
68
public _modalNavigationDepth = 0 ;
69
69
70
70
constructor ( private frameService : FrameService ) {
@@ -178,6 +178,21 @@ export class NSLocationStrategy extends LocationStrategy {
178
178
routerLog ( "NSLocationStrategy.replaceState changing existing state: " +
179
179
`${ state } , title: ${ title } , url: ${ url } , queryParams: ${ queryParams } ` ) ;
180
180
}
181
+
182
+ const tree = this . currentUrlTree ;
183
+
184
+ if ( url !== tree . toString ( ) ) {
185
+ const urlSerializer = new DefaultUrlSerializer ( ) ;
186
+ const stateUrlTree : UrlTree = urlSerializer . parse ( url ) ;
187
+ const rootOutlets = stateUrlTree . root . children ;
188
+
189
+ Object . keys ( rootOutlets ) . forEach ( outletName => {
190
+ const outlet = this . findOutletByKey ( outletName ) ;
191
+ const topState = outlet . peekState ( ) ;
192
+
193
+ topState . segmentGroup = rootOutlets [ outletName ] ;
194
+ } ) ;
195
+ }
181
196
} else {
182
197
if ( isLogEnabled ( ) ) {
183
198
routerLog ( "NSLocationStrategy.replaceState pushing new state: " +
@@ -502,7 +517,7 @@ export class NSLocationStrategy extends LocationStrategy {
502
517
503
518
const locationState : LocationState = {
504
519
segmentGroup : currentSegmentGroup ,
505
- isRootSegmentGroup : lastState ? lastState . isRootSegmentGroup : false ,
520
+ isRootSegmentGroup : false ,
506
521
isPageNavigation : isNewPage
507
522
} ;
508
523
0 commit comments