octicon-rss(16/)
You've already forked ionic-framework
mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 22:44:13 +08:00
fix(angular): expose router.navigate()
fixes #15332
This commit is contained in:
octicon-git-branch(16/)
octicon-tag(16/)
octicon-diff(16/tw-mr-1) 1 changed files with 17 additions and 4 deletions
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user