PrimeNg数据列表角4

问题描述:

不工作我有一个数据列表使用primeng但在运行应用程序时,我得到这个错误:PrimeNg数据列表角4

不能绑定到“价值”,因为它不是一个'对DataList控件'

已知财产的HTML文件:

<p-dataList [value]="cars"> 
    <ng-template let-car pTemplate="item"> 
     Car content 
    </ng-template> 
</p-dataList> 

我的组件文件是:

@Component({ 
    selector: 'app-root', 
    templateUrl: './app.component.html', 
    styleUrls: ['./app.component.css'] 
}) 
export class AppComponent { 
    title = 'app'; 
} 

export class DataListDemo implements OnInit { 

     cars: Car[]; 

     constructor(private carService: CarService) { } 

     ngOnInit() { 
      this.carService.getCarsLarge().then(cars => this.cars = cars); 
     } 
    } 

我认为你需要将以下添加到您的app.module.ts并将其添加到进口模块列表

import { DataTableModule } from 'primeng/primeng';