我只是想在我的 Angular 4 项目中实现 PrimeNG 库。我可以在我的依赖项和我的 nodemodules 文件夹中看到 PrimeNG,但是当我做了一个简单的操作时:
<p-dataTable >
<p-column ></p-column>
<p-column ></p-column>
<p-column ></p-column>
<p-column ></p-column>
</p-dataTable>
这是我控制台浏览器中的错误:
Unhandled Promise rejection: Template parse errors:
'p-column' is not a known element:
1. If 'p-column' is an Angular component, then verify that it is part of this module.
2. If 'p-column' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
<p-dataTable >
[ERROR ->]<p-column ></p-column>
<p-column ></p-column>
<p-column ></p-column>
"): ng:///AppModule/TableaudebordComponent.html@5:4
这是我的 app.module.ts:
import { TableaudebordComponent } from './tableaudebord.component';
import { RouterModule, Routes } from '@angular/router'
import { ToggleComponent } from './toggle.component';
import { HttpModule } from '@angular/http';
import { routeConfig } from './router-config';
import { AppComponent } from './app.component';
import { UserService } from './user.service'; // <-- #1 import service
@NgModule({
imports: [ BrowserModule, HttpModule, RouterModule.forRoot(routeConfig)
],
declarations: [ AppComponent, DashboardComponent, PageNotFoundComponent, NavbarComponent,PetitPaveInfraComponent, PaveInfraComponent, PetitPaveAppliComponent, DashboardnextComponent, Dashboardnext2Component, Dashboardnext3Component, PetitPaveProblemComponent, PaveProblemComponent, ToggleComponent, TableaudebordComponent ],
providers: [ UserService ],
bootstrap: [ AppComponent ]
})
export class AppModule { }