无法解析Angular2中DataTable primeng的所有参数

时间:2017-06-30 07:38:55

标签: angular primeng

我试图从primeng中实现DataTable组件。我收到错误消息说无法解析DataTable的所有参数:([object Object],[object Object],?,[object Object],[object Object])

//dashboard module
import { NgModule } from '@angular/core';
import { ChartsModule } from 'ng2-charts/ng2-charts';
import { DropdownModule } from 'ng2-bootstrap/dropdown';
import { DashboardComponent } from './dashboard.component';
import { DashboardRoutingModule } from './dashboard-routing.module';
import { DataTableModule } from 'primeng/primeng';
@NgModule({
imports: [
DashboardRoutingModule,
ChartsModule,
  DropdownModule, DataTableModule
],
declarations: [ DashboardComponent ]
})
export class DashboardModule { }

//dashboard component
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
@Component({
templateUrl: 'dashboard.component.html'
})
export class DashboardComponent implements OnInit {
cars: PrimeCar[];
constructor() { }
ngOnInit() {
    for (let i = 0; i < 100; i++) {
        this.cars.push(new PrimeCar("Car" + i, 1990 + i, "V", "Red"));
    }
}

class PrimeCar  {
constructor(public vin?, public year?, public brand?, public color?) { }
}

//dashboard html
<div class="animated fadeIn">
  <div class="row">
     <div class="col-md-12">
         <p-dataTable [value]="cars">
             <p-column field="vin" header="Vin"></p-column>
             <p-column field="year" header="Year"></p-column>
             <p-column field="brand" header="Brand"></p-column>
             <p-column field="color" header="Color"></p-column>
         </p-dataTable>
     </div>
 </div>
</div>

我正在使用angular2 2.4.9和primeng primeng@4.1.0-rc.2

0 个答案:

没有答案