0

안녕 얘들 아, typescript, 각도 응용 프로그램에서 일하고 있습니다.TypesScript 응용 프로그램에서 Angular-DataTable을 만드는 방법

데이터 생성을 위해 나는 Angular-DataTable을 사용했습니다.

거기에서 하나의 샘플 응용 프로그램을 만들었습니다. 나는 아래에 코드를 추가 한 컨트롤러 하나를 만들었습니다.

constructor(protected $scope: ng.IScope, protected $element: ng.IAugmentedJQuery, protected $timeout: ng.ITimeoutService, 
    protected dtOptionsBuilder: any, protected dTColumnDefBuilder:any) { 

    var self = this; 

    this.dtOptions = dtOptionsBuilder.newOptions() 
     .withPaginationType('full_numbers') 
     .withDisplayLength(10) 
     .withOption('bInfo', false) 
     .withOption('bPaginate', false) 
     .withOption('searching', false) 
     .withOption('paging', false) 
     .withOption('order', [0, 'desc']); 

    this.dtColumnDefs = [ 
     dTColumnDefBuilder.newColumnDef(0), 
     dTColumnDefBuilder.newColumnDef(1), 
     dTColumnDefBuilder.newColumnDef(2), 
     dTColumnDefBuilder.newColumnDef(3), 
     dTColumnDefBuilder.newColumnDef(4), 
     dTColumnDefBuilder.newColumnDef(5).notSortable() 
    ]; 

모듈 종속성에 'datatables'를 추가했습니다. 이 응용 프로그램을 실행 한 후. 나는 아래 오류 받고있다.

angular.js:13424TypeError: Cannot read property 'newOptions' of undefined 
at new Controller (app.controller.js:17) 
at Object.invoke (angular.js:4625) 
at S.instance (angular.js:10027) 
at n (angular.js:8965) 
at angular.js:9362 
at angular.js:15757 
at m.$eval (angular.js:17025) 
at m.$digest (angular.js:16841) 
at m.$delegate.__proto__.$digest (<anonymous>:844:31) 
at m.$apply (angular.js:17133) 

유형 스크립트에서 angular-dataTable을 구현하는 방법을 알려주십시오. 내 프로젝트에 DtoptionBuilder 및 DtColumnDefBuilder를 어떻게 추가 할 수 있습니까?

답변

0

당신은이 두 DTOptionsBuilderDTColumnBuilder

수정 된 코드

constructor(protected $scope: ng.IScope, protected $element: ng.IAugmentedJQuery, protected $timeout: ng.ITimeoutService, 
    protected DTOptionsBuilder: any, protected DTColumnBuilder:any) { 

    var self = this; 

    this.dtOptions = this.DTOptionsBuilder.newOptions() 
     .withPaginationType('full_numbers') 
     .withDisplayLength(10) 
     .withOption('bInfo', false) 
     .withOption('bPaginate', false) 
     .withOption('searching', false) 
     .withOption('paging', false) 
     .withOption('order', [0, 'desc']); 

    this.dtColumnDefs = [ 
     this.DTColumnBuilder.newColumnDef(0), 
     this.DTColumnBuilder.newColumnDef(1), 
     this.DTColumnBuilder.newColumnDef(2), 
     this.DTColumnBuilder.newColumnDef(3), 
     this.DTColumnBuilder.newColumnDef(4), 
     this.DTColumnBuilder.newColumnDef(5).notSortable() 
    ]; 
} 
에게 주입 할 필요가
관련 문제