在我的控制器中我有这个方法: ..............
angular.extend($scope.criteria, $scope.items);
angular.extend($scope.criteriaList, $scope.itemsUpdate);
console.log('scope %O: ' ,$scope.criteria);
console.log('scope_ %O: ' ,$scope.criteriaList);
updateList.getItems($scope.criteria,$scope.criteriaList, function(data){
});
and in my service I did this:
amServices.factory('updateList', [ function() {
var updateList= new function(){};
updateList.getItems = function( items, itemsUpdate,callback){
console.log('itemsUpdat e%O ' , itemsUpdate);
callback(itemsList);
}
return updateList
});
但我无法打印结果..
你知道为什么吗?
答案 0 :(得分:0)
你的var updateList应该是一个函数数组,而不是函数本身。如下所示
amServices.factory('updateList', [ function() {
var updateList= {};
updateList.getItems = function( items, itemsUpdate,callback){
console.log('itemsUpdat e%O ' , itemsUpdate);
callback(itemsList);
}
return updateList
});