I started with Angular 2 RC5 and PrimeNG 1.0.0-beta.13 beta. I'm loading PrimeNg components as xModules and has no problems displaying Data Table, Input, SelectItem, Buttons, modals. However, I'm getting this error when I try to use TabView or Accordion.
Unhandled Promise rejection: Template parse errors: 'p-accordionTab' is not a known element:
I imported the TabViewModule in the @NgModule. Currently, I updated my app to use Angular 2.0.0 (final) and PrimeNg beta.16 (latest) but still having the errors. I'm using webpack to chunk polyfills, vendor and app codes and I'm seeing accordion and tabview modules in the webpack-generated js files.
I'm not sure what I'm missing. Let me know if you need more info.
Thanks in advance!
Some snippets:
app.module.ts
import {
ButtonModule,
DataTableModule,
DialogModule,
GrowlModule,
TabViewModule,
AccordionModule } from 'primeng/primeng';
@NgModule({
...
imports: [
DataTableModule,
DialogModule,
GrowlModule,
TabViewModule,
AccordionModule
],
...
});
template.html (pasted from PrimeNG docs)
<p-accordion>
<p-accordionTab header="Header 1">
Content 1
</p-accordionTab>
<p-accordionTab header="Header 2">
Content 2
</p-accordionTab>
<p-accordionTab header="Header 3">
Content 3
</p-accordionTab>
The problem is primeng need animation package so i just import BrowserAnimationsModule in appModule.
npm install primeng
npm install primeng --save
app.module.ts
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {AccordionModule} from 'primeng/primeng';
@NgModule({
imports: [
AccordionModule,
BrowserAnimationsModule
],
})
app.component.html
<p-accordion>
<p-accordionTab header="Header 1">
Content 1
</p-accordionTab>
<p-accordionTab header="Header 2">
Content 2
</p-accordionTab>
<p-accordionTab header="Header 3">
Content 3
</p-accordionTab>
</p-accordion>
.angular-cli.json
"styles": [
"../node_modules/primeng/resources/themes/omega/theme.css",
"../node_modules/primeng/resources/primeng.min.css"
],
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With