-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to import latest angular2-highcharts using AOT compiler #163
Comments
Yes, it is known issue |
May be some of the steps suggested here could help solve this issue - |
Any updates on this issue? |
I used the workaround provided above (#160) to move on for now: |
I don't recall having any issues of that nature. Just make sure you import your statics and your export function defined |
Yeah I keep getting that same error, it's almost like a race condition... |
Just a note on the #160 workaround. It seems like this fix has a huge performance degradation associated with it. |
Used following code in my app module and its running fine
|
did you try running rollup afterwards? I'm getting 'Uncaught (in promise): ReferenceError: require is not defined' error |
I am getting the same error core.es5.js:1084 ERROR Error: Uncaught (in promise): Error: Template parse errors: |
Any update on whether this will be fixed without requiring a workaround? |
Any updates on this issue? |
having the same issue |
bump |
Also curious about a solution that does not require a workaround |
Please use following setting in app.module.ts import { ChartModule } from 'angular2-highcharts'; declare var require: any; export function highchartsFactory() { ], I hope issue will be resolved at both end deceleration time and options using time.
|
I used a different approach to come around the issue.
That's it. Now your code should compile on aot mode. Hope this helps. |
We use the regular approach, and it works with aot. Just import and apply the modules. // For: regular highcharts.
import * as highcharts from 'highcharts/highcharts';
import * as highchartsMore from 'highcharts/highcharts-more';
import * as bullet from 'highcharts/modules/bullet';
// Or for: styled mode. Remember to import the provided css file from the highcharts package.
import * as highcharts from 'highcharts/js/highcharts';
import * as highchartsMore from 'highcharts/js/highcharts-more';
import * as bullet from 'highcharts/js/modules/bullet';
@NgModule({
imports: [
ChartModule,
],
providers: [
{
provide: HighchartsStatic,
useFactory: highchartsFactory
},
],
})
export class AppModule { }
export function highchartsFactory() {
// Default options.
highcharts.setOptions({
global: {
useUTC: false
}
});
// Initialize addons.
highchartsMore(highcharts);
bullet(highcharts);
return highcharts;
} Works like a charm. |
Thanks @Jrubzjeknf, it worked perfectly. |
Using angular2-highcharts with webpack and AOT compiler. The app module does not like the ChartModule.forRoot(require('highcharts')). I get the following error when I build:
ERROR in Error encountered resolving symbol values statically. Calling function 'ChartModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in ... /app/app.module.ts, resolving symbol AppModule in ... /app/app.module.ts
It worked fine before upgrading to "angular2-highcharts": "0.5.5", "@types/highcharts": "4.2.47",
Is there a workaround or how should I configure this?
I have tried using a function to return highcharts like this:
export function highchartsFactory() {
return highcharts;
}
ChartModule.forRoot(highchartsFactory()),
but I get the same error.
The text was updated successfully, but these errors were encountered: