Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

Ionic 3 + Angular 5. SQLite open database

  • Hi guys.

    I’m doing on Ionic 3 + Angular 5 project.
    While trying to connect sqlite i have use ionic-sqlite and plugin cordova-sqlite-storage.

    But the sqlitePlugin is alerted undefined in window.

    window.sqlitePlugin.openDatabase({ name: gm_public.sql_data.db + ‘.db’, location: ‘default’ });

    Can someone help me fix this one.

    Thank you

  • administrators

    If the plugin variable is undefined, check the following:

    1. The plugin is being installed during the build. You should see it in the build log.

    2. You are accessing the plugin variable after the deviceready event. You can make sure of this by adding an event listener and using the plugin variable in the callback function e.g.:

    document.addEventListener(‘deviceready’, () => {
    // call the variable here

    1. You are calling the correct variable. You can verify the correct variable by going to the plugin’s plugin.xml file (usually available on the plugin’s GitHub page) and checking the target of the clobbers tag e.g.:

    <clobbers target=“FirebasePlugin” />

    This means the variable is window.FirebasePlugin.

    1. If you are using Monaca Debugger, make sure you are using a Custom Build Debugger, not the App Store version of the Debugger. The App Store version only includes the core plugins, not third-party plugins, so you need to create a Custom Build Debugger by selecting the ‘Custom Build Debugger’ option from the Build for iOS or Build for Android page. This will create a version of Monaca Debugger with all your project’s plugins.