Answer the question
In order to leave comments, you need to log in
Why does the browser give an error?
services.js
angular.module('events.services', [])
.factory('EventService', function($http, $cordovaSQLite) {
return {
getDataFromDB: function() {
var query = 'SELECT id, title, img, coords, details, dateString, timestamp FROM events ORDER BY timestamp DESC';
$cordovaSQLite.execute(db, query).then(function(response) {
result = response;
return result;
});
}
}
})
angular.module('events.controllers', ['events.services'])
.controller('NearCtrl', function($scope, $http, $cordovaSQLite, EventService) {
EventService.getDataFromDB().then(function(result) {
console.log(result);
});
}
Answer the question
In order to leave comments, you need to log in
angular.module('events.services', [])
.factory('EventService', function($http, $cordovaSQLite) {
return {
getDataFromDB: function() {
var query = 'SELECT id, title, img, coords, details, dateString, timestamp FROM events ORDER BY timestamp DESC';
return $cordovaSQLite.execute(db, query);
}
}
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question