Skip to content

Commit

Permalink
fix(angular): expose router.navigate()
Browse files Browse the repository at this point in the history
fixes #15332
  • Loading branch information
manucorporat committed Aug 26, 2018
1 parent ae9c6f2 commit 7aa4f13
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions angular/src/providers/nav-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7aa4f13

Please sign in to comment.