SQLite Please Help

Hi,
I am fairly new to the Ionoc framework. I have been experimenting with JSON flat files until now but I don’t think it will do what I need it to do. I am now experimenting with SQLite. I have followed a tutorial of how to set it up, I have set it exactly as specified but I am getting an error when I try to INSERT something into the database. Below is the error I am getting, if someone could point me in the right direction it would be appreciated. Also getting an open database error.
Thanks
Errors:
Uncaught TypeError: Cannot read property ‘openDatabase’ of undefined

TypeError: Cannot read property ‘transaction’ of undefined
at Object.execute (ng-cordova.min.js:9)
at Scope.$scope.insert (app.js:154)
at $parseFunctionCall (ionic.bundle.js:20264)
at ionic.bundle.js:52360
at Scope.$get.Scope.$eval (ionic.bundle.js:22320)
at Scope.$get.Scope.$apply (ionic.bundle.js:22419)
at HTMLButtonElement. (ionic.bundle.js:52359)
at HTMLButtonElement.eventHandler (ionic.bundle.js:10933)
at triggerMouseEvent (ionic.bundle.js:2853)
at tapClick (ionic.bundle.js:2842)

try structuring SQLite like this :smile:

I’m currently opening my databases like so -

.factory('DB', function($q, DB_CONFIG) {

var self = this;

self.db = null;

self.init = function() {
 
self.db = window.openDatabase(DB_CONFIG.name, '1.0', 'database', 5*1024*1024);
........
return self;
});

Thanks for the help. Having trouble getting my head around the MVC structure of ionic. I have used the exmaple above to see how it works but I can’t get it to work correctly. I am getting an error, I know I’m probably missing something obvious but if you could bear with me it would be greatly appreciated.

myApp = starter i.e starter.config etc

Error:

Uncaught Error: [$injector:modulerr] Failed to instantiate module starter due to:
Error: [$injector:modulerr] Failed to instantiate module starter.services due to:
Error: [$injector:modulerr] Failed to instantiate module starter.config due to:
Error: [$injector:nomod] Module ‘starter.config’ is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

Bingo! The same name that’s in your app.js

Mine is also named starter so my app.js starts like this

angular.module('starter', ['starter.controllers', 'starter.services', 'ionic'])

services.js starts like this

angular.module('starter.services', ['starter.config'])

config.js starts like this

angular.module('starter.config', [])

Also remember to reference your config & services js files in your index.html

Thanks, I knew I would miss something obvious, I hadn’t referred to config.js in my index.html. Thats sorted that problem but now I have another will try to cure on my own and see if helps my understanding. Many thanks.