fix(back-button): subscribe to body

This commit is contained in:
Manu Mtz.-Almeida
2018-09-11 10:54:22 +02:00
parent 8f5b45c539
commit 37c9be7453
3 changed files with 4 additions and 3 deletions

View File

@ -21,7 +21,7 @@ export class NavController {
private location: Location,
@Optional() private router?: Router
) {
window && window.addEventListener('ionBackButton', (ev) => {
window && window.document.body.addEventListener('ionBackButton', (ev) => {
(ev as BackButtonEvent).detail.register(0, () => this.goBack());
});
}

View File

@ -21,7 +21,8 @@
"unpkg": "dist/ionic.js",
"files": [
"dist/",
"css/"
"css/",
"loader/"
],
"dependencies": {
"ionicons": "4.4.3"

View File

@ -23,7 +23,7 @@ export function startHardwareBackButton(win: Window) {
}
}
});
win.dispatchEvent(ev);
win.document.body.dispatchEvent(ev);
if (handlers.length > 0) {
let selectedPriority = Number.MIN_SAFE_INTEGER;