The only thing I changed is I have created separate files for popover.tspopover.html.
After all those changes everything worked fine in browser. But when I test that in Android device, when I try to dismiss the popover (either by calling this.viewController.dismiss() method or clicking on backdrop) I see that UI hung up and nothing happens.
I checked logs in Android Monitoring tool then I found following exception in log.
[INFO:CONSOLE(34947)] "EXCEPTION: Error in ./PopoverCmp class PopoverCmp - inline template:0:14", source: file:///android_asset/www/build/js/app.bundle.js (34947)
[INFO:CONSOLE(34947)] "ORIGINAL EXCEPTION: RangeError: Maximum call stack size exceeded", source: file:///android_asset/www/build/js/app.bundle.js (34947)
[INFO:CONSOLE(34947)] "ORIGINAL STACKTRACE:", source: file:///android_asset/www/build/js/app.bundle.js (34947)
[INFO:CONSOLE(34947)] "RangeError: Maximum call stack size exceeded
at Object.re.RequireObjectCoercible (file:///android_asset/www/build/js/es6-shim.min.js)
at Object.re.ToObject (file:///android_asset/www/build/js/es6-shim.min.js:10:4947)
at Function.keys (file:///android_asset/www/build/js/es6-shim.min.js:10:24378)
at _baseExtend (file:///android_asset/www/build/js/app.bundle.js:69658:27)
at _baseExtend (file:///android_asset/www/build/js/app.bundle.js:69665:17)
at _baseExtend (file:///android_asset/www/build/js/app.bundle.js:69665:17)
at _baseExtend (file:///android_asset/www/build/js/app.bundle.js:69665:17)
at _baseExtend (file:///android_asset/www/build/js/app.bundle.js:69665:17)
at _baseExtend (file:///android_asset/www/build/js/app.bundle.js:69665:17)
at _baseExtend (file:///android_asset/www/build/js/app.bundle.js:69665:17)", source: file:///android_asset/www/build/js/app.bundle.js (34947)
[INFO:CONSOLE(34947)] "ERROR CONTEXT:", source: file:///android_asset/www/build/js/app.bundle.js (34947)
[INFO:CONSOLE(34947)] "[object Object]", source: file:///android_asset/www/build/js/app.bundle.js (34947)
[INFO:CONSOLE(260)] "Uncaught EXCEPTION: Error in ./PopoverCmp class PopoverCmp - inline template:0:14
ORIGINAL EXCEPTION: RangeError: Maximum call stack size exceeded
ORIGINAL STACKTRACE:
RangeError: Maximum call stack size exceeded
at Object.re.RequireObjectCoercible (file:///android_asset/www/build/js/es6-shim.min.js)
at Object.re.ToObject (file:///android_asset/www/build/js/es6-shim.min.js:10:4947)
at Function.keys (file:///android_asset/www/build/js/es6-shim.min.js:10:24378)
at _baseExtend (file:///android_asset/www/build/js/app.bundle.js:69658:27)
at _baseExtend (file:///android_asset/www/build/js/app.bundle.js:69665:17)
at _baseExtend (file:///android_asset/www/build/js/app.bundle.js:69665:17)
at _baseExtend (file:///android_asset/www/build/js/app.bundle.js:69665:17)
at _baseExtend (file:///android_asset/www/build/js/app.bundle.js:69665:17)
at _baseExtend (file:///android_asset/www/build/js/app.bundle.js:69665:17)
at _baseExtend (file:///android_asset/www/build/js/app.bundle.js:69665:17)
ERROR CONTEXT:
[object Object]", source: file:///android_asset/www/build/js/zone.js (260)
Debugger is no longer active
On which Android version are you testing? And check if there’s no warning or error in the browser console as well. You could also check out this SO question for some ideas what might cause the problem (e.g. accidentally importing/embedding the same JS file twice, etc).
All other part of the app I am developing is working very fine and smoothly. Just it doesn’t close when clicked on backdrop and it shows the exception.
The object that is passed to ToObject() method is too big - this will work on a desktop browser because it has bigger stack so it could handle it but obviously fails on mobile.
It might be an issue with the es6-shimToObject() method (either a bug or it’s not very effective or not optimized) - most desktop browsers should have a native implementation of this method and therefore it works fine but obviously on mobile there’s no native implementation yet.
Could you open an issue about this so that someone from the Ionic team also takes a look at it?
then erase the old apk file from Your_project/platforms/android/build/outputs/apk
ionic run android / ionic build android
Update:
First time I stumbled on this exception, it was happening only on physical devices.
Crosswalk solved it.
Then it happened again but on the browser this time.
I realised it only happen when I try to call the popover from a DIV. A button or ion-item
do not triggers the exception.
I manage to work around it by passing “null” as an event before presenting the popover: