Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ERROR in Error during template compile of 'AppModule' Function calls are not supported in decorators but 'ChartModule' was called. #254

Open
yash27 opened this issue Jan 31, 2018 · 5 comments

Comments

@yash27
Copy link

yash27 commented Jan 31, 2018

I installed angular2-highcharts on my Angular Project, implemented that. Its working but in ng serve mode. But when I executed the command ng build --prod. I got the error :
Error during template compile of 'AppModule'
Function calls are not supported in decorators but 'ChartModule' was called.

Its working fine when i executed ng build.

Here is my app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { platformBrowserDynamic }  from '@angular/platform-browser-dynamic';
import { NgModule } from '@angular/core';
import { ChartModule } from 'angular2-highcharts';
import { AppComponent } from './app.component';
import { HttpModule } from '@angular/http';

declare var require : any;

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,HttpModule,
    ChartModule.forRoot(require('highcharts/highstock'),require('highcharts/modules/drilldown')),
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
platformBrowserDynamic().bootstrapModule(AppModule);
@GerkinDev
Copy link

Same issue here...

@AzeemMalik51
Copy link

Any solution?

@mynameiseswar
Copy link

Any updates on this issue?

@k1ng440
Copy link

k1ng440 commented Feb 20, 2018

same issue here. someone please fix it

@AbdulRayhman
Copy link

For me this works:

`//File: app.module.ts
import { ChartModule } from 'angular2-highcharts';
import { HighchartsStatic } from 'angular2-highcharts/dist/HighchartsService';

export function highchartsFactory() {
const hc = require('highcharts/highstock');
const dd = require('highcharts/modules/exporting');
dd(hc);
return hc;
}

//Section: Imports
imports:[ChartModule],

//Section: Providers
providers:[
{
provide: HighchartsStatic,
useFactory: highchartsFactory
}
]`

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants