SQLite opening DB on app.js and using in controller.js


Hi, i’m using this tutorial to help me with SQLite: https://www.thepolyglotdeveloper.com/2014/11/use-sqlite-instead-local-storage-ionic-framework/

So here’s my question:
Do i have to initialize the DB in my Controller.js to use SQLite Inserts and Selects?

I have made everything in the tutorial:

  • Initialized a var called db before my module.
  • Put the openDb in my .run $ionicPlatform.ready().
  • Created a table.

My app.js module:
angular.module('starter', ['ionic', 'starter.controllers', 'starter.azure', 'ionic-material', 'ngCordova'])
My Controllers.js module:
angular.module('starter.controllers', ['starter.azure'])

An now i need to know how to access the database from my controllers in my controller.js so i can use CRUD functions there.