Ionic version: (check one with "x")
[ ] 1.x
[X ] 2.x
I'm submitting a ... (check one with "x")
[X ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
-- ionViewCanLeave() results in error "Uncaught (in promise): false" when user taps on an ion-tab
Expected behavior:
-- ion-tabs should not produce a runtime error when user taps on a tab when ionViewCanLeave() returns false.
Steps to reproduce:
-- Setup an Ionic project with tabs
-- On a page, attempt to implement ionViewCanLeave() where it returns false.
-- Attempt to tab on another tab while ionViewCanLeave() returns false.
Related code:
ionViewCanLeave(): boolean {
if(this.canLeave) {
return true;
}
return false;
}
Other information:
[15:12:48] console.error: EXCEPTION: Uncaught (in promise): false
[15:12:48] console.error: ORIGINAL STACKTRACE:
[15:12:48] console.error: s@http://172.16.11.198:8100/build/polyfills.js:3:4220
http://172.16.11.198:8100/build/polyfills.js:3:3962 reject@http://172.16.11.198:8100/build/main.js:29365:29
_viewTest@http://172.16.11.198:8100/build/main.js:29616:26
_queueTrns@http://172.16.11.198:8100/build/main.js:29386:23
_touchActive@http://172.16.11.198:8100/build/main.js:28936:30 handleEvent_0
http://172.16.11.198:8100/build/main.js:102131:41 [native code]
http://172.16.11.198:8100/build/main.js:36725:51
__tryOrUnsub@http://172.16.11.198:8100/build/main.js:1240:20
next@http://172.16.11.198:8100/build/main.js:1189:34 _next@http://172.16.11.198:8100/build/main.js:1142:30
next@http://172.16.11.198:8100/build/main.js:1106:23 next@http://172.16.11.198:8100/build/main.js:5016:29
emit@http://172.16.11.198:8100/build/main.js:36705:80
onClick@http://172.16.11.198:8100/build/main.js:69107:28 handleEvent handleEvent_0
http://172.16.11.198:8100/build/main.js:102131:41 [native code]
http://172.16.11.198:8100/build/main.js:39433:48
invokeTask@http://172.16.11.198:8100/build/polyfills.js:3:9728
onInvokeTask@http://172.16.11.198:8100/build/main.js:37504:47
invokeTask@http://172.16.11.198:8100/build/polyfills.js:3:9671
runTask@http://172.16.11.198:8100/build/polyfills.js:3:7093
invoke@http://172.16.11.198:8100/build/polyfills.js:3:10843 dispatchEvent@[native code]
handleTapPolyfill@http://172.16.11.198:8100/build/main.js:71769:36
pointerEnd@http://172.16.11.198:8100/build/main.js:71679:35 [native code]
handleTouchEnd@http://172.16.11.198:8100/build/main.js:110368:41 [native code]
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
Cordova CLI: 6.5.0
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: 1.9.0
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v6.9.3
Xcode version: Xcode 8.2.1 Build version 8C1002
Hey @emersonstewart , would you mind posting a repo or a plunker i can use to reproduce this issue with? Unfortunately I am not able to reproduce it locally. Thanks!
I've setup a Plunker that replicates this error. You can view it at http://plnkr.co/edit/qV7nPi?p=preview
Thank you for looking into this
Thanks for the plunker, i can now repro this issue. (:
We are ionic-angular 2.0.0-rc.5 and we are facing same issue , IS it solved in later versions or not ?
@jgw96 Im still getting this issue.
It seems like the documentation says you should catch the error manually when pushing the page, but in case of implicit navigation (like tabs) there is no way to do that.
Ah nvm, I see the release version was modified from 2.0.1 to 2.1.0.
Thanks!
@manucorporat your fix is only for tabs. If you don't use tabs in your app, and you hit the back button, you still get the same error!
What @gujiman mentions is correct, I have already reported it in issue #10404 (closed by Justin, referenced in this issue) and it's reported in issue #10253 reported by someone else, also referenced in this ticket.
@jgw96 it seems the issues mentioned above are related to this one, but are not the same issue, so they shouldn't have been closed and referenced in this one, as this one is about tabs, while the other is about the Android back button.
Thanks for your efforts and the awesome Ionic framework.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Most helpful comment
We are ionic-angular 2.0.0-rc.5 and we are facing same issue , IS it solved in later versions or not ?