32
rated 0 times
[
34]
[
2]
/ answers: 1 / hits: 93330
/ 10 Years ago, mon, march 3, 2014, 12:00:00
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
?
More From » angularjs