Hello,
I'm having a hard time adding any 3rd party modules. I've tried PrimeNG and ag-grid, with little success. I have been successful at adding a 3rd party module to the base repository ( AngularClass/angular2-webpack-starter). I then try to replicate what I did with an instance of this repository and I end up with odd errors on load:
Error: Unexpected value 'AccordionModule' imported by the module 'AppModule'. Please add a @NgModule annotation.
at syntaxError (file:///D:/devtools/js/tutorials/angular-electron-dream-starter/dist/vendor.dll.js:16427:34) []
at file:///D:/devtools/js/tutorials/angular-electron-dream-starter/dist/vendor.dll.js:29321:44 []
at Array.forEach (native) []
at CompileMetadataResolver.vendor_lib.136.CompileMetadataResolver.getNgModuleMetadata (file:///D:/devtools/js/tutorials/angular-electron-dream-starter/dist/vendor.dll.js:29304:49) []
at JitCompiler.vendor_lib.136.JitCompiler._loadModules (file:///D:/devtools/js/tutorials/angular-electron-dream-starter/dist/vendor.dll.js:40485:64) []
I've found this on the web angular/angular#15763 but not sure how that relates to this project.
First this is what I did to get PrimeNG to work with a fresh clone of AngularClass/angular2-webpack-starter:
new CopyWebpackPlugin([
{ from: 'src/assets', to: 'assets' },
{ from: 'src/meta'},
{
from: 'node_modules/font-awesome/css/font-awesome.min.css',
to: 'assets/font-awesome/css/font-awesome.min.css'
},
{
from: 'node_modules/font-awesome/fonts',
to: 'assets/font-awesome/fonts'
},
{ from: 'node_modules/primeng/resources', to: 'assets/primeng/resources' }
]),
open /config/head-config.common.js
add following line ~40
/** tags for primeng and font-awesome **/
{ rel:"stylesheet", type:"text/css", href:"/assets/primeng/resources/themes/omega/theme.css" },
{ rel:"stylesheet", type:"text/css", href:"/assets/primeng/resources/primeng.min.css" },
{ rel:"stylesheet", type:"text/css", href:"/assets/font-awesome/css/font-awesome.min.css" }
open /src/app/app.module.ts
add line 2
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
add line 32
import { AccordionModule } from 'primeng/components/accordion/accordion';
add BrowserAnimationsModule and AccordionModule (this is from primeng) to imports (line ~61):
imports: [ // import Angular's modules
BrowserModule,
BrowserAnimationsModule,
FormsModule,
HttpModule,
AccordionModule,
RouterModule.forRoot(ROUTES, { useHash: true, preloadingStrategy: PreloadAllModules })
],
in /src/app/home/home.component.ts line 3 add
<p-accordion>
<p-accordionTab header="Godfather I" [selected]="true">
The story begins as Don Vito Corleone, the head of a New York Mafia family, overseeshis daughter's wedding. His beloved son ichael has just come home from the war, but does not intend to become part of his father's business. T hrough Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family.
</p-accordionTab>
<p-accordionTab header="Godfather II">
Francis Ford Coppola's legendary continuation and sequel to his landmark 1972 film, The_Godfather parallels the young Vito Corleone's rise with his son Michael's spiritual fall, deepening The_Godfather's depiction of the dark side of the American dream. In the early 1900s, the child Vito flees his Sicilian village for America after the local Mafia kills his family. Vito struggles to make a living, legally or illegally, for his wife and growing brood in Little Italy, killing the local Black Hand Fanucci after he demands his customary cut of the tyro's business. With Fanucci gone, Vito's communal stature grows.
</p-accordionTab>
<p-accordionTab header="Godfather III">
After a break of more than 15 years, director Francis Ford Coppola and writer Mario Puzo returned to the well for this third and final story of the fictional Corleone crime family. Two decades have passed, and crime kingpin Michael Corleone, now divorced from his wife Kay has nearly succeeded in keeping his promise that his family would one day be completely legitimate.
</p-accordionTab>
</p-accordion>
<p-accordion>
<p-accordionTab header="Godfather I" [selected]="true">
The story begins as Don Vito Corleone, the head of a New York Mafia family, overseeshis daughter's wedding. His beloved son ichael has just come home from the war, but does not intend to become part of his father's business. T hrough Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family.
</p-accordionTab>
<p-accordionTab header="Godfather II">
Francis Ford Coppola's legendary continuation and sequel to his landmark 1972 film, The_Godfather parallels the young Vito Corleone's rise with his son Michael's spiritual fall, deepening The_Godfather's depiction of the dark side of the American dream. In the early 1900s, the child Vito flees his Sicilian village for America after the local Mafia kills his family. Vito struggles to make a living, legally or illegally, for his wife and growing brood in Little Italy, killing the local Black Hand Fanucci after he demands his customary cut of the tyro's business. With Fanucci gone, Vito's communal stature grows.
</p-accordionTab>
<p-accordionTab header="Godfather III">
After a break of more than 15 years, director Francis Ford Coppola and writer Mario Puzo returned to the well for this third and final story of the fictional Corleone crime family. Two decades have passed, and crime kingpin Michael Corleone, now divorced from his wife Kay has nearly succeeded in keeping his promise that his family would one day be completely legitimate.
</p-accordionTab>
</p-accordion>
go back to command line and do:
npm start
you should see:
Everything works.
I repeat the above steps but instead clone this repository. I run into two problems:
- The exception noted above
- Resource load failures
Failed to load resource: net::ERR_FILE_NOT_FOUND primeng.min.css
Failed to load resource: net::ERR_FILE_NOT_FOUND font-awesome.min.css
Failed to load resource: net::ERR_FILE_NOT_FOUND theme.css
Although even with the resource load failure it should at least run, just not look good.
Any hints on what steps I should follow when adding a module like PrimeNG to this?
Things I've tried:
- update the version of Angular to 4.0.3 from 4.0.2, no effect.
Thanks
Greg.