question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How import a module in Ionic 2 App

See original GitHub issue

Hello guys,

I would like to import the module ‘highcharts-more’, i need use a polar chart (http://www.highcharts.com/demo/polar) in my Ionic 2 App.

declare var require: any;

const Highcharts = require('../../node_modules/highcharts/highcharts.src');
const HighchartsMore = require('../../node_modules/highcharts/highcharts-more.js');

HighchartsMore(Highcharts);

I have been try this code above, but not work’s.

Regards

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:24 (6 by maintainers)

github_iconTop GitHub Comments

10reactions
webprofusion-chrisccommented, Feb 20, 2017

@peterpeterparker thank, yes I hadn’t done a prod build after all! The hybrid approach (avoiding the ‘require’ var) I ended up with was:

..
..
import { HighchartsStatic } from 'angular2-highcharts/dist/HighchartsService';
import { ChartModule } from 'angular2-highcharts';
import * as highcharts from 'highcharts';
..
..
export function highchartsFactory() {
  return highcharts;
}
..
..

@NgModule({
..
...
  imports: [
    IonicModule.forRoot(MyApp),
    ChartModule
  ],
..
..
  providers: [
  ...
    {
      provide: HighchartsStatic,
      useFactory: highchartsFactory
    },

  ]
})

1reaction
julioazecommented, Jun 2, 2017

Hi guys. Even following the examples above, I can not get the activity gauge to work. Help me please!

Uncaught ReferenceError: Highcharts is not defined at highcharts-more.js:8 at highcharts-more.js:8

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create and Import Module in Ionic 2 - KhoPhi's Blog
The imports take external modules and exports we want available in the current module. Then we declare the components that play with the...
Read more >
IonicModule - Ionic API Documentation
IonicModule is an NgModule that bootstraps an Ionic App. By passing a root component, ... directives, and providers from the framework are imported....
Read more >
An Introduction to NgModule for Ionic 2 | Josh Morony
The module handles importing and declaring all of the Ionic specific stuff for us, so we don't need to manually import the List...
Read more >
Using Angular modules in Ionic applications - Mastering Ionic
Here you can see that the necessary modules are imported first followed by the @NgModule metadata object which is used to define the...
Read more >
App.Module imports not working on Ionic pages - Stack Overflow
I think that you'll have to create another module and keep all your required imports/exports there and import that module in app.module.ts ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found