@@ -58,13 +58,13 @@ export interface LocationState {
5858
5959@Injectable ( )
6060export class NSLocationStrategy extends LocationStrategy {
61- private outlets : Array < Outlet > = [ ] ;
6261 private currentOutlet : Outlet ;
6362
6463 private popStateCallbacks = new Array < ( _ : any ) => any > ( ) ;
6564 private _currentNavigationOptions : NavigationOptions ;
6665 private currentUrlTree : UrlTree ;
6766
67+ public outlets : Array < Outlet > = [ ] ;
6868 public _modalNavigationDepth = 0 ;
6969
7070 constructor ( private frameService : FrameService ) {
@@ -178,6 +178,21 @@ export class NSLocationStrategy extends LocationStrategy {
178178 routerLog ( "NSLocationStrategy.replaceState changing existing state: " +
179179 `${ state } , title: ${ title } , url: ${ url } , queryParams: ${ queryParams } ` ) ;
180180 }
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+ }
181196 } else {
182197 if ( isLogEnabled ( ) ) {
183198 routerLog ( "NSLocationStrategy.replaceState pushing new state: " +
@@ -502,7 +517,7 @@ export class NSLocationStrategy extends LocationStrategy {
502517
503518 const locationState : LocationState = {
504519 segmentGroup : currentSegmentGroup ,
505- isRootSegmentGroup : lastState ? lastState . isRootSegmentGroup : false ,
520+ isRootSegmentGroup : false ,
506521 isPageNavigation : isNewPage
507522 } ;
508523
0 commit comments