I'm encountering an issue with my db factory where the data returned from the database is coming back as 'undefined' after successfully posting it to the client.
This is how my factory function is structured:
uno.factory('adbFactory', ['$http', function($http){
var fact = {};
fact.get = function(http, query, isAll) {
//var query = "get all blog_posts";
http.post('php/adb/adb.php', {'query': query, 'all': isAll})
.success(function(data){
//console.log(data);
return data;
})
.error(function(){
console.log('Error...');
});
};
return fact;
}]);
My controller implementation looks like this:
uno.controller('newsCtrl', function($scope, $http, adbFactory){
$scope.derp = 'derp!!!!!';
console.log(adbFactory.get($http, 'get users 1', false));
});
Ignore the 'get users 1 etc etc' string. I have a PHP function that generates an SQL query based on input parameters. Is there anything in particular I should focus on improving within my factory code?