2015-01-20 6 views
0

공장에서 함수를 만들고 싶습니다. 하지만 내 매개 변수를 전달하는 방법을 이해하지 않습니다.공장에서 매개 변수 사용

매개 변수 q에서 어떻게 동적 매개 변수를 설정할 수 있습니까?

app.factory('Item', ['$resource', 
    function($resource){ 
     return $resource(ApiUrl('items/:id'), {}, { 
      get: { cache: false }, 
      getWithName: { params: {q: 'tshirt'}, isArray: true, cache: false }, 
      query: { isArray: true, cache: true } 
     }); 
    } 
]); 

// Code Sample 
$scope.items = Item.getWithName(q:$route.current.params.name); 

답변

0
$scope.items = Item.getWithName({q:$route.current.params.name}); 
+0

신 오 .. 릴레이 및 그 테스트 해달라고? 남자 .... thnkx. –