From 7aa4f1310522ae37165808c54f95baba6a07b43c Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Sun, 26 Aug 2018 19:19:01 +0200 Subject: [PATCH] fix(angular): expose router.navigate() fixes #15332 --- angular/src/providers/nav-controller.ts | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/angular/src/providers/nav-controller.ts b/angular/src/providers/nav-controller.ts index c897a6d061..885d5e7ca9 100644 --- a/angular/src/providers/nav-controller.ts +++ b/angular/src/providers/nav-controller.ts @@ -21,19 +21,32 @@ export class NavController { @Optional() private router?: Router ) {} - navigateForward(url: string | UrlTree, animated?: boolean, extras?: NavigationExtras) { + navigateForward(url: string | UrlTree | any[], animated?: boolean, extras?: NavigationExtras) { this.setIntent(NavIntent.Forward, animated); - return this.router!.navigateByUrl(url, extras); + if (Array.isArray(url)) { + return this.router!.navigate(url, extras); + } else { + return this.router!.navigateByUrl(url, extras); + } } navigateBack(url: string | UrlTree, animated?: boolean, extras?: NavigationExtras) { this.setIntent(NavIntent.Back, animated); - return this.router!.navigateByUrl(url, { replaceUrl: true, ...extras }); + extras = { replaceUrl: true, ...extras }; + if (Array.isArray(url)) { + return this.router!.navigate(url, extras); + } else { + return this.router!.navigateByUrl(url, extras); + } } navigateRoot(url: string | UrlTree, animated?: boolean, extras?: NavigationExtras) { this.setIntent(NavIntent.Root, animated); - return this.router!.navigateByUrl(url, extras); + if (Array.isArray(url)) { + return this.router!.navigate(url, extras); + } else { + return this.router!.navigateByUrl(url, extras); + } } goBack(animated?: boolean) {