2016-06-25 3 views
0

내 웹 페이지에 캘린더를 표시하고 싶습니다. 아래의 코드가 제대로 작동합니다. [ 'ui.calendar']를 angular.module()에 넣지 마십시오. 그러나이 경우 calendar는 표시되지 않고,이를 angular.module()에 추가하면 위의 오류가 표시됩니다. 도와주세요!

답변

0

'use strict'; 
 
(function(){ 
 

 
class CalendarComponent { 
 
    constructor() { 
 
    this.eventSources = []; 
 
    
 
    this.uiConfig = { 
 
     calendar : { 
 
       editable : true, 
 
       header : { 
 
         left : 'prev,next,today', 
 
         centre : 'title', 
 
         right : 'month,agendaWeek,agendaDay' 
 
         } 
 
        } 
 
       } 
 
    } 
 
} 
 

 
angular.module('sangamApp',['ui.calendar']) 
 
    .component('calendar', { 
 
    templateUrl: 'app/calendar/calendar.html', 
 
    controller: CalendarComponent 
 
    }); 
 

 
})();

'use strict'; 
 

 
angular.module('sangamApp') 
 
    .config(['$stateProvider',function ($stateProvider) { 
 
    $stateProvider 
 
     .state('calendar', { 
 
     url: '/calendar', 
 
     template: '<calendar></calendar>' 
 
     }); 
 
    }]);

당신은 $stateProvider 사용 내 두 개의 자바 스크립트 파일입니다하지만 당신은 당신의 모듈 종속성에 ui.router을 넣어 잊어 버렸습니다.

angular.module('sangamApp',['ui.calendar', 'ui.router']) // added ui.router 
+0

하지만 은 내가 이상하다 'ui.router' – Robin

+0

를 추가하면 내가 'ui.calendar'뿐만 아니라 'ui.router를'.... 넣어하지 않았고, 심지어 작동하지의 경우, 잘 작동했다 . 첫 번째 자바 스크립트 파일이 주 js 파일입니까? 또한 파일 중 어느 것이 먼저로드됩니까? –

0

당신이 angular.module에 두 번째 매개 변수로 모든 모듈 종속성의 목록을 통과해야하고 $stateProvider을 사용하고 있기 때문에 당신이 dependecies

의 목록에 ui.router를 지정해야합니다 응용 프로그램 모듈을 선언 처음
angular.module('sangamApp',['ui.calendar', 'ui.router'])