2014-01-10 1 views
0

와 ServiceMethod : ..............AngularJS와 나는이 방법이 더 많은 매개 변수 내 컨트롤러에

 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

var updateList는 함수 자체가 아닌 함수 배열이어야합니다. 아래처럼

amServices.factory('updateList', [ function() {    
     var updateList= {}; 
    updateList.getItems = function(items, itemsUpdate,callback){ 
     console.log('itemsUpdat e%O ' , itemsUpdate); 

        callback(itemsList); 

} 

return updateList 
      }); 
+0

@Opeyemi : 나는 같은 문제가있다 ..... console.log ('itemsUpdat e % O', itemsUpdate); does not work .... 컨트롤러에서 매개 변수를 서비스 메소드로 전달하는 것은 맞습니까? – user880386

관련 문제