Hey everyone, I'm currently working on a TypeScript and Angular application.
To create a data table, I decided to use Angular-DataTable.
After creating a sample application using it, I added the following code to my Controller:
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()
];
Upon adding 'datatables' to my module dependencies and running the application, an error was encountered:
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)
I'm now seeking guidance on how to properly implement angular-dataTable in TypeScript. Any suggestions on how to add DtoptionBuilder and DtColumnDefBuilder to my project would be greatly appreciated.