Errors using the ngCordova $cordovaSQLite plugin

I am currently trying to implement the ngCordova SQLite plugin with my app but have yet to produce a working solution. I have followed Nic Raboy’s blog post on how to implement the SQLite plugin with your Ionic project to a “T,” but I am still receiving the error: Error: undefined is not an object (evaluating ‘$window.sqlitePlugin.openDatabase’) when I try to run the application in the iOS emulator.

I have also verified that ngCordova and the plugin have been loaded into my project.

My code is below.


angular.module('whoPaidLast', ['ionic', 'ngCordova', 'whoPaidLast.controllers', ''])

.run(function($ionicPlatform, $cordovaSQLite) {
    $ionicPlatform.ready(function() {
        if(window.cordova && window.cordova.plugins.Keyboard) {
        if(window.StatusBar) {

        db = $cordovaSQLite.openDB({ name: 'accounts.db' });
        $cordovaSQLite.execute(db, 'CREATE TABLE IF NOT EXISTS accounts (id integer primary key autoincrement, firstname text, lastname text, paid numeric, date text)');


angular.module('whoPaidLast.controllers', [])

.controller('DashCtrl', ['$ionicPlatform', '$scope', '$ionicModal', '$ionicActionSheet', '$cordovaSQLite', function ($ionicPlatform, $scope, $ionicModal, $ionicActionSheet, $cordovaSQLite) {
	$scope.getList = function() {
		var query = 'SELECT id, firstname, lastname, paid, date FROM accounts ORDER BY lastname ASC';
		var db = $cordovaSQLite.openDB({ name: 'accounts.db' });

		$ionicPlatform.ready(function() {
			$cordovaSQLite.execute(db, query, [id, firstname, lastname, paid, date]).then(function(result) {
				if(result.rows.length > 0) {
					console.log('rows =' + result.rows);
				} else {
					$scope.results = [];
			}, function(error) {

Have a look at:
It seems to be working. I have not tested myself. Planning to do that today.

Tested and it works!

Hi! Do you have this code? the page doesn’t work. Thanks