0

I'm trying to upgrade my Angular2 app from rc5 to rc6 and am having trouble with the angular2-datatable directives. I moved them to the NgModule definition under the declarations section, but still get the following error when running the app...

Error in app/dashboard.component.html:3:93 caused by: Object doesn't support property or method 'orderBy'

This data table worked fine with rc5, so I'm assuming it is having trouble finding the directives with the switch to rc6.

Here is my module definition...

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { DataTableDirectives } from 'angular2-datatable/datatable';
import { routing, appRoutingProviders } from './app.routing';
import { AppComponent }  from './app.component';
import { DashboardComponent } from './dashboard.component';
import { DataService } from './data.service';

@NgModule({
  imports:      [ BrowserModule, routing ],
  declarations: [ DataTableDirectives, AppComponent, DashboardComponent ],
  providers:    [ appRoutingProviders, DataService ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

Has anyone else been successful running angular2-datagrid with rc6 (or even rc5 using the NgModule declarations)?

Andrew Patzer
  • 255
  • 1
  • 4
  • 9
  • I decided to just use JQuery DataTable directly. I added an AfterViewInit hook to my component and ran the .dataTable() function on my table. It works great. I'd still be interested in an answer to my original question though if somebody has gotten angular2-datatable to work with Angular2 rc6. – Andrew Patzer Sep 08 '16 at 18:22
  • No need for jQuery, it will cause troubles in the future definitely when managing data such as change detection, there is a nice native datatable from PrimeNG. http://www.primefaces.org/primeng/#/datatable – Cagatay Civici Sep 17 '16 at 22:19

0 Answers0