Skip to content

Commit

Permalink
fix(angular): back button prevents default
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Apr 3, 2018
1 parent 7e97006 commit 4db687e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions angular/src/directives/navigation/ion-back-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ export class IonBackButton {
private elementRef: ElementRef,
) {}

@HostListener('click')
onClick() {
@HostListener('click', ['$event'])
onClick(ev: Event) {
if (this.routerOutlet && this.routerOutlet.canGoBack()) {
this.routerOutlet.pop();
ev.preventDefault();
} else if (this.router && this.defaultHref != null) {
this.router.navigateByUrl(this.defaultHref);
ev.preventDefault();
}
}
}

0 comments on commit 4db687e

Please sign in to comment.