I have two functions on my service. One just returns a string which works fine and displays on the view perfect. But the other function does a $http call to the backend. The $http call works fine but am not able to pull the results through to the controller
(function(){
var videoStoreApp = angular.module('videoStoreApp', ['ui.router']);
videoStoreApp.factory('videoListService', function($http, $rootScope){
var myService = {};
myService.getData = function()
{
return $http({
method: 'GET',
url: 'app/services/getDvd.php'
}).then(function(data){
var returnObj = {
complete:true,
data: data.data
};
return returnObj;
});
};
myService.getSum = function()
{
return 'services test';
};
return myService;
});
})();
This is how i call the service from the controller...
angular.module('videoStoreApp').component('videoList', {
templateUrl: 'app/views/videoList.html',
controller: function videoListFunction($http,$scope,videoListService){
$scope.test3 = videoListService.getSum();
$scope.dvd = videoListService.getData();
};
}
});
Can someone please help. This my first time posting a question on stack over flow