I am new to AngularJS and find it very interesting, but I am a bit unclear about the following situation.
app.factory('deleteFac', function($http){
var factory = {};
factory.edit = function(id){
$http.get('?controller=store&action=getDetail&id=' + id).
success(function(data, status){
/**
got an error on the following
when i use return data; and i get data undefined
in the controller which i get it because its doing a ajax call
you don't get data until the call first.
**/
$scope.detail = data;
})
}
return factory;
})
I am getting error when I assign to $scope and use return data, is there anyway I can assign the return data to the $scope?
edit, or accept a callback that passesdataalong. You can't inject $scope since it'd have no idea what scope to inject.