Hello guys,
After spending some time looking for a chart library, I found this one angular2-highcharts.
I did the npm install angular2-highcharts --save
, and add it to my appmodule:
import { NgModule } from '@angular/core';
import { IonicApp, IonicModule } from 'ionic-angular';
import { ChartModule } from 'angular2-highcharts';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
@NgModule({
declarations: [
MyApp,
HomePage
],
imports: [
ChartModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage,
],
providers: []
})
export class AppModule {}
But when I run the ionic serve
, I got this error:
\...\node_modules\angular2-highcharts\index.js does not export ChartModule
The only one who works fine for me was ng2-charts. But I needed to add the script tag
manually on src\index.html
, like this:
<!-- cordova.js required for cordova apps -->
<script src="cordova.js"></script>
<!-- The polyfills js is generated during the build process -->
<script src="build/polyfills.js"></script>
<!-- Chart.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.3.0/Chart.min.js"></script>
<!-- The bundle js is generated during the build process -->
<script src="build/main.js"></script>
Is there another way to fix that, instead of putting the script tag
, to load the Chart.js ? Or I could download the Chart.js and put inside a folder on my Ionic Project ? I don’t know where to put, where is the best place.
If I don’t use the script tag, console shows these errors:
Thanks.
My Ionic Version:
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1