मैं() मेरी कोणीय नियंत्रककोणीय तो फिर() मान्यता प्राप्त नहीं है
angular.module('n2goApp')
.controller('MainCtrl', function($scope, Products) {
Products.get(). then(function (response) {
$scope.data = response;
console.log(response);
$scope.totalPages = response.TotalPages;
$scope.totalItems = response.total;
$scope.products = response.data;
$scope.currentPage = response.current_page;
$scope.maxSize = 5;
$scope.setPage = function(pageNo) {
$scope.currentPage = pageNo;
};
});
});
में तो फिर इस्तेमाल करने की कोशिश, लेकिन मुझे एक त्रुटि चला जाता है
Error: Products.get(...).then is not a function
सेवा
angular.module('n2goApp')
.service('N2goservice', function N2goservice() {
// AngularJS will instantiate a singleton by calling "new" on this function
}).factory('Products', ['$resource', function($resource) {
var url = 'http://domain.com/api/products';
return $resource(url + '/:prodID',
{ bookId: '@prodID' }, {
loan: {
method: 'PUT',
params: { prodId: '@prodID' },
isArray: false
},
get:{
method: 'GET',
params: {
prodId: '@prodID',
page:'@page'
},
isArray: false
}
/* , method3: { ... } */
});
}]);
मैं क्या गलत कर रहा हूँ?
आप उत्पाद सेवा के कोड दे सकते हैं? – cuttlas
प्रतिक्रिया पोस्ट करने के लिए – fefe