-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
685d5a1
commit 1f78390
Showing
2 changed files
with
7 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
import { Directive, HostListener, Optional } from '@angular/core'; | ||
import { Directive, HostListener, Input, Optional } from '@angular/core'; | ||
import { IonRouterOutlet } from './ion-router-outlet'; | ||
import { Router } from '@angular/router'; | ||
|
||
@Directive({ | ||
selector: 'ion-back-button' | ||
}) | ||
export class IonBackButton { | ||
|
||
@Input() defaultHref: string; | ||
|
||
constructor( | ||
@Optional() private router: Router, | ||
@Optional() private routerOutlet: IonRouterOutlet, | ||
) {} | ||
|
||
@HostListener('click') | ||
onClick() { | ||
if (this.routerOutlet && this.routerOutlet.canGoBack()) { | ||
this.routerOutlet.pop(); | ||
} else if (this.router && this.defaultHref != null) { | ||
this.router.navigateByUrl(this.defaultHref); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.