2

I have created a new project using angular-cli I followed all the steps that are suggested at the page https://www.npmjs.com/package/angular2-highcharts

npm install angular2-highcharts --save import { ChartModule } from 'angular2-highcharts'; ChartModule.forRoot(require('highcharts')

When I run the app, it says cannot find name 'require' Do I need to follow any other steps.

3
  • You can a live example with the config of angular2 with highcharts embed.plnkr.co/IuwjpPB1YQW1T7i4B8SZ Commented Apr 3, 2017 at 10:35
  • I'm having the same issue. Using system.config works fine (like in the example @morganfree linked to) but the second you try to aot compile with angular cli poop hits the fan and you can't execute a rollup. Commented Apr 12, 2017 at 20:09
  • You can try following workaround for making it work for AOT rollup build davidsekar.com/angularjs/… Commented Apr 27, 2017 at 15:44

1 Answer 1

1

Try to add this dclaration on your component : declare var require: any;

I had the same problem. I didn't have much time to resolve the problem. So i used ng2-highchart (an alternative for angular2-highcharts).

-you can follow instruction for installation by there

-You will find the github project for more informations.

-With an example on Angular-Cli .

Sign up to request clarification or add additional context in comments.

1 Comment

This worked somewhat but not working for angular 8

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.