TypeError: Cannot read property 'openDatabase' of undefined
You might take a look at this tutorial:
https://www.thepolyglotdeveloper.com/2014/11/use-sqlite-instead-local-storage-ionic-framework/
When you see this error:
TypeError: Cannot read property 'openDatabase' of undefined
It is happening for one of a few reasons:
- You are not wrapping the
$cordovaSQLite
methods in the$ionicPlatform.ready()
function. - You are trying to test this native plugin from a web browser.
- You have not actually installed the base SQLite plugin into your project.
The most common reasons for this error are #1 and #2. Native plugins, must be used only after the application is confirmed ready, thus the $ionicPlatform.ready()
method. Since native plugins use native code, you cannot test them from your web browser.
Read through the tutorial I linked because it should help you.
Regards,