fix(angular): expose router.navigate()

fixes #15332
This commit is contained in:
Manu Mtz.-Almeida
2018-08-26 19:19:01 +02:00
parent ae9c6f2adb
commit 7aa4f13105

View File

@ -21,20 +21,33 @@ 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);
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);
if (Array.isArray(url)) {
return this.router!.navigate(url, extras);
} else {
return this.router!.navigateByUrl(url, extras);
}
}
goBack(animated?: boolean) {
this.setIntent(NavIntent.Back, animated);