From 0eee94bbedf849f3a113d5d8d4f2e9ca80ce4d5d Mon Sep 17 00:00:00 2001 From: bellalMohamed Date: Tue, 25 Aug 2020 13:38:34 +0200 Subject: [PATCH 1/2] fix: page navigation bug if there's not outlet for frame after clearing history --- nativescript-angular/router/ns-location-strategy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nativescript-angular/router/ns-location-strategy.ts b/nativescript-angular/router/ns-location-strategy.ts index 99c3b8a3c..4c0088c8b 100644 --- a/nativescript-angular/router/ns-location-strategy.ts +++ b/nativescript-angular/router/ns-location-strategy.ts @@ -342,7 +342,7 @@ export class NSLocationStrategy extends LocationStrategy { NativeScriptDebug.routerLog('NSLocationStrategy._beginPageNavigation()'); } - this.currentOutlet = this.getOutletByFrame(frame); + this.currentOutlet = this.getOutletByFrame(frame) || this.currentOutlet; const lastState = this.currentOutlet.peekState(); if (lastState) { From 113ce43b0c3f1af81de312802913524433499457 Mon Sep 17 00:00:00 2001 From: bellalMohamed Date: Wed, 26 Aug 2020 17:05:39 +0200 Subject: [PATCH 2/2] making prettier happy --- .../router/ns-router-link-active.ts | 12 ++--- nativescript-angular/router/ns-router-link.ts | 47 +++++++++---------- 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/nativescript-angular/router/ns-router-link-active.ts b/nativescript-angular/router/ns-router-link-active.ts index e9a2fa504..b00a35679 100644 --- a/nativescript-angular/router/ns-router-link-active.ts +++ b/nativescript-angular/router/ns-router-link-active.ts @@ -105,12 +105,12 @@ export class NSRouterLinkActive implements OnChanges, OnDestroy, AfterContentIni const currentUrlTree = this.router.parseUrl(this.router.url); const isActiveLinks = this.reduceList(currentUrlTree, this.links); this.classes.forEach((c) => { - if (isActiveLinks) { - this.renderer.addClass(this.element.nativeElement, c); - } else { - this.renderer.removeClass(this.element.nativeElement, c); - } - }); + if (isActiveLinks) { + this.renderer.addClass(this.element.nativeElement, c); + } else { + this.renderer.removeClass(this.element.nativeElement, c); + } + }); } Promise.resolve(hasActiveLinks).then((active) => (this.active = active)); } diff --git a/nativescript-angular/router/ns-router-link.ts b/nativescript-angular/router/ns-router-link.ts index b380d7178..23aa97bac 100644 --- a/nativescript-angular/router/ns-router-link.ts +++ b/nativescript-angular/router/ns-router-link.ts @@ -52,30 +52,29 @@ export class NSRouterLink { private commands: any[] = []; - constructor(private ngZone: NgZone, private router: Router, private navigator: RouterExtensions, private route: ActivatedRoute, private el: ElementRef) { - } - - ngAfterViewInit() { - this.el.nativeElement.on('tap', () => { - this.ngZone.run(() => { - if (NativeScriptDebug.isLogEnabled()) { - NativeScriptDebug.routerLog(`nsRouterLink.tapped: ${this.commands} ` + `clear: ${this.clearHistory} ` + `transition: ${JSON.stringify(this.pageTransition)} ` + `duration: ${this.pageTransitionDuration}`); - } - - const extras = this.getExtras(); - // this.navigator.navigateByUrl(this.urlTree, extras); - this.navigator.navigate(this.commands, { - ...extras, - relativeTo: this.route, - queryParams: this.queryParams, - fragment: this.fragment, - preserveQueryParams: attrBoolValue(this.preserveQueryParams), - queryParamsHandling: this.queryParamsHandling, - preserveFragment: attrBoolValue(this.preserveFragment), - }); - }); - }); - } + constructor(private ngZone: NgZone, private router: Router, private navigator: RouterExtensions, private route: ActivatedRoute, private el: ElementRef) {} + + ngAfterViewInit() { + this.el.nativeElement.on('tap', () => { + this.ngZone.run(() => { + if (NativeScriptDebug.isLogEnabled()) { + NativeScriptDebug.routerLog(`nsRouterLink.tapped: ${this.commands} ` + `clear: ${this.clearHistory} ` + `transition: ${JSON.stringify(this.pageTransition)} ` + `duration: ${this.pageTransitionDuration}`); + } + + const extras = this.getExtras(); + // this.navigator.navigateByUrl(this.urlTree, extras); + this.navigator.navigate(this.commands, { + ...extras, + relativeTo: this.route, + queryParams: this.queryParams, + fragment: this.fragment, + preserveQueryParams: attrBoolValue(this.preserveQueryParams), + queryParamsHandling: this.queryParamsHandling, + preserveFragment: attrBoolValue(this.preserveFragment), + }); + }); + }); + } @Input('nsRouterLink') set params(data: any[] | string) { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy