nativescript-angular
nativescript-angular copied to clipboard
Feature Request: Support for replaceUrl and skipLocationChange
The options for replaceUrl and skipLocationChange are available in the router's ExtendedNavigationExtras, but they are not being implemented in the PageRouterOutlet. When you try to use either of them
this.routerExtensions.navigate(["/tab"], { replaceUrl: true })
//OR
this.routerExtensions.navigate(["/tab"], { skipLocationChange: true })
Navigation fails to skip the a page in the stack, and navigates back to the page that the application was on.
These features would be nice for when an application wants to route to a new page while removing part of the router location history.
+1 Hopefully this really gets done in 3.2 and the 3.2 release isn't too far away!
This seems to be the only way to successfully add an interstitial login page that doesn't get added to History. For example:
- Home page that does not require login
- Routing for nested page: { path: "foo", component: FooComponent, canActivate: [AuthGuard] }
- AuthGuard:
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
if (LoginService.isLoggedIn()) {
return true;
} else {
this.redirectUrl = state.url;
this.router.navigate(["/login"], { skipLocationChange: true });
return false;
}
}
and redirect code once login is successful:
this.router.navigate([this.redirectUrl]);
Issue #284 suggests to use a modal dialog, but I don't think I can do that in this scenario: the AuthGuard can't display it and there are 4 or 5 pages I want to protect with login, so implementing it for each page is untenable.
Hi there. I was looking for 3.2 release to fix this feature, but as I see it is not there. Do you have any info when can this be implemented? Or is it any workaround?
Hi, Any updates on this features?
any updates guys?
any updates on skipLocationChange?
+1
+1
Anybody know any workarounds?
EDIT - not exactly what this feature request is asking for, but for those searching on Google:
import { RouterExtensions } from 'nativescript-angular/router';
...
this.router.navigate(['/somewhere'], { clearHistory: true }); // remove history after navigating
+1
+1
+1
+1
+1
+1
+1
+1
Would love to see support for this.
+1
any updates regarding this feature request? the use case would be important for us and I don't see a good workaround for this yet
+1000000000
So excited got the new release of N8 with A12, but not without this features yet!
+1