‘p-header’不是PrimeNg for Angular2应用程序中的已知元素

前端之家收集整理的这篇文章主要介绍了‘p-header’不是PrimeNg for Angular2应用程序中的已知元素前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用PrimeNg作为我的angular2项目,我正在尝试在页面添加面板.我使用下面的代码获取primeng教程( http://www.primefaces.org/primeng/#/panel): –

我的html文件有以下代码: –

  1. <p-panel>
  2. <p-header>
  3. Header content here
  4. </p-header>
  5. Body Content
  6. </p-panel>

我在primeng的模块中添加了导入的必需模块: –

  1. import { NgModule,CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
  2. import { MyComponent } from './my.component';
  3. import { CommonModule } from '@angular/common';
  4. import { SharedModule,PanelModule } from 'primeng/primeng';
  5.  
  6.  
  7. @NgModule({
  8. imports: [
  9. CommonModule,SharedModule,PanelModule
  10. ],declarations: [MyComponent],schemas: [CUSTOM_ELEMENTS_SCHEMA ]
  11. })
  12. export class ThemeModule { }

这在控制台中抛出以下错误: –

EXCEPTION: Uncaught (in promise): Error: Template parse errors:
‘p-header’ is not a known element:
1. If ‘p-header’ is an Angular component,then verify that it is part of this module.
2. If ‘p-header’ is a Web Component then add “CUSTOM_ELEMENTS_SCHEMA” to the ‘@NgModule.schemas’ of this component to suppress this message.
(“

随着2.0-RC.1 primeng的改变,以及如果你升级你的版本,它将工作.

猜你在找的Angularjs相关文章