2014-01-21 4 views
0

나는 카르마로 각 컨트롤러에 대한 단위 테스트를 작성합니다. 당신은 모든 컨트롤러를 볼 수 있습니다각형 컨트롤러 가져 오기 목록보기

describe('TestController', function() { 

    var $scope, $rootScope, service1, sevice2, service3, $controller; 

    beforeEach(module('TestModule')); 

    beforeEach(function() { 
     inject(function($injector) { 
      service1= $injector.get('service1'); 
      service2= $injector.get('service2'); 
      service3= $injector.get('service3'); 
      $scope = $injector.get('$rootScope').$new(); 

      $controller = $injector.get('$controller')('TestController', { 
       $scope: $scope 
      });    
     }); 
    }); 

    /* it blocks */ 
}); 

으로 내가 손에 의해 $ 인젝터, 단계적에서 얻을 주입 : 것 같습니다.

질문입니다. 간단히 말해서 모든 TestController 목록을 가져올 수 있습니까? 이 테스트에 대한

컨트롤러 기능 샘플 :

['$scope', '$rootScope', 'service1', 'sevice2', 'service3'] or similar 

답변

1

인젝터 개체의 annotate 방법은 당신에게 종속의 목록을 제공합니다 :

function($scope, $rootScope, service1, sevice2, service3) 

내가 얻을 필요가있다.

+0

오, 감사합니다.) 문서를 다시 읽으려면 시간이 필요합니다. –

관련 문제