I keep encountering this error message: TypeError: Cannot read property 'ready' of undefined
Here is the snippet of my code:
angular.module('app', ['ionic', 'app.controllers', 'app.routes', 'app.directives','app.services', 'ngCordova'])
.run(function($ionicPlatform, $cordovaSQLite) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
});
});
angular.module('app.services', [])
.service('DatabaseService', [function($cordovaSQLite, $ionicPlatform) {
var db;
$ionicPlatform.ready(function () {
if(window.cordova) {
db = $cordovaSQLite.openDB("auftragDB");
} else {
db = window.openDatabase("auftragDB", "1.0", "Offline Artikel Datenbank", 10*1024*1024);
}
$cordovaSQLite.execute(db, "CREATE TABLE IF NOT EXISTS ArtikelTable (ticket_id number(10), kunde char(100))");
});
}])
I am really puzzled as to why it can't seem to locate the $ionicPlatform...
Warm regards, Pearson