mardi 5 mai 2015

How to make the http request in Angular in my case?

I am having an issue loading a $resource object in my case.

I have something in parent controller like

$scope.data = Product.$query();

then in the child controller, I have

$scope.data.then(function(product){
     console.log(data);
})

My factory

angular.module('testApp').factory('Product', ['$resource', function ($resource) {
    return $resource('/api/product');
}]);

I am getting $scope.data.then is not a function error in my child controller I am not sure what's going on here. Can someone help me about it? Thanks a lot

Aucun commentaire:

Enregistrer un commentaire