I need to overwrite the back button action with the function which uses parameters. I see that the function is being worked, but when I print the expected parameter (console.log in my back-button handler), when it writes that the parameter is undefined.
I have this in the view: <view on-back="goBack('discard')">
And in app.js: function goBack(navType) { console.log(navType); }
It shows me “undefined” in the console.
Please tell me what I’m doing wrong.
Rather than passing in the “discard” string, you could define the function as on-back="discard()". If the “discard” needs to be a parameter, my suggestion would be to use a javascript or view variable to define the navType rather than passing in the string directly in the on-back function.