Chart can not be compiled with AOT

UI Components for Angular
Post Reply
Mr230268
Posts: 5
Joined: 21 Jan 2018, 21:04

21 Jan 2018, 21:17

Hello,

I didn't find an answer in the web and I'm relativles new to primeng and angular. Hope somone can held me out.

I added primeng chart to my project and during development everything works well.

But when I compile I get the following error:

ERROR in : Unexpected value 'ChartModule in ../hb/node_modules/primeng/chart.js' imported by the module 'AppModule in ../hb/src/app/hb.module.ts'. Please add a @NgModule annotation.

My workaround is right now to compile without AOT.

What I found out is that it can be an incompatibility in the angular versions and the module. I use primeng 5.2.0-rc.1.

Here is my angular version:

Angular CLI: 1.6.5
Node: 8.9.0
OS: win32 x64
Angular: 5.2.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

@angular/cli: 1.6.5
@angular-devkit/build-optimizer: 0.0.41
@angular-devkit/core: 0.0.28
@angular-devkit/schematics: 0.0.51
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.5
@schematics/angular: 0.1.16
typescript: 2.6.2
webpack: 3.10.0

Thanks!

Mr230268
Posts: 5
Joined: 21 Jan 2018, 21:04

22 Jan 2018, 19:30

I solved the problem by removing the chartmodule from the AppModule.

I use now chart.js directly. A good explanation how it works is here:

https://stackoverflow.com/questions/463 ... -angular-4

If you use chart.js instead of p-chart and the chart can be changed during display (in my application you can switch via drop down list), the old one had to be destroyed before creating a new one. If not and you move your mouse over the new one, the old one appears sometimes. I just mention it because it happened in my application. In the primeng wrapper a new data object also destroys the old one.

Edit:
It seems to me, that when I add a new primeng module like InputSwitch it happens, too. No possible AOT compile. Maybe the reason is because I also updated the cli and angular itself.
Right now I make no AOT compile. I checked the loading time and I experienced no difference. Maybe in one of the future releases it is fixed.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 15 guests