2014-10-06 6 views
1

RequireJS 정의 메소드 내에 AngularJS 모듈을 작성하는 데 문제점이 있습니다. 내가 필요로하는 UI를 라우터 모듈을 참조 할 때RequireJS 내의 AngularJS 모듈 작성이 종속성으로 정의됩니다.

는 각도는 저에게 말한다 : 나는 requireJS에서 uiRouter 의존성 목록을 정의하면

Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to: 
Error: [$injector:nomod] Module 'myApp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. 

에만이 발생합니다.

여기 내 코드입니다 : 나는 정의 종속 배열에서 uiRouter을 경우

require.config({ 
    paths : { 
     'angular' : "/script/lib/angular", 
     'uiRouter' :"/script/lib/angular-ui-router", 

    }, 
    shim : { 
     'angular': { 
      exports : 'angular' 
     }, 
     'uiRouter' : { 
      deps : ['angular'] 
     } 
    } 

}); 

define(['angular', 'uiRouter'], function (angular) { 
    var module = angular.module('myApp', []); 
}); 

, 모든 것이 기대 작품으로. 내가 도대체 ​​뭘 잘못하고있는 겁니까?

+0

당신의 requirejs 버전은 무엇입니까? –

+0

각 (Angular) : v1.3.0-rc.4 –

+0

내 계산서를 어디에서 편집 했나요? – Blackunknown

답변

0

모듈에 ui.router를 추가해야합니다.

define(['angular', 'uiRouter'], function (angular) { 
    var module = angular.module('myApp', ['ui.router']); 
}); 

편집 : 내가 추가 한 다음

define('myApp', ['angular', 'uiRouter'], function (angular) { 
    var module = angular.module('myApp', ['ui.router']); 
}); 
+0

나는 그것을 시도했지만 같은 문제가 발생합니다. –

+0

편집 문제를 해결하지 못할 수도 있지만 편집을 추가하고있었습니다. : P 다른 것을 볼 수 있습니다. – Blackunknown