我正在尝试将primeng-table与angular7一起使用。但是在集成它之后,我收到以下错误:-
Uncaught TypeError: Object(...) is not a function at platform.es5.js:102 at Module../node_modules/@angular/cdk/esm5/platform.es5.js (platform.es5.js:104) at webpack_require (bootstrap:78) 在 Module../node_modules/@angular/cdk/esm5/scrolling.es5.js (scrolling.es5.js:1) 在webpack_require (bootstrap:78) 在 Object../node_modules/primeng/ components/dropdown/dropdown.js (dropdown.js:12) 在webpack_require (bootstrap:78) 在 Object../node_modules/primeng/components/paginator/paginator.js (paginator.js:15) 在webpack_require (bootstrap:78 ) ) 在 Object../node_modules/primeng/components/datagrid/datagrid.js (datagrid.js:15)
.html 文件
<html>
<div class="courses">
<h1>This is the Courses Page!</h1>
<br><br><br><br>
</div>
<p-dataTable [value]="courses">
<p-column field="id" header="id"></p-column>
<p-column field="name" header="name"></p-column>
</p-dataTable>
</html>
组件文件
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-courses',
templateUrl: './courses.component.html',
styleUrls: ['./courses.component.less']
})
export class CoursesComponent implements OnInit {
courses: any[];
constructor() { }
ngOnInit() {
this.courses = [
{ id: '1', name: 'Course1' },
{ id: '2', name: 'Course2' },
{ id: '3', name: 'Course3' }
];
}
}
你可以在这里找到完整的代码 -代码
谁能告诉我我做错了什么?
谢谢!