I want to make a graph on my web app.
I don't understand how angular with highcharts works.
I use this lib : github.com/pablojim/highcharts-ng and this framework : ionicframework.com/
I think it can be the same with apache cordova.
I made a simple page with :
<highchart id="chart1" config="chartConfig"></highchart>
then, on my app.js :
var app = angular.module('myApp', ['ionic', 'ui.router', 'highcharts-ng']);
then on my controller js page :
angular.module('myApp').controller('Dashboard',....)
{
$scope.chartConfig = {
options: {
chart: {
type: 'bar'
}
},
series: [{
data: [10, 15, 12, 8, 7]
}],
title: {
text: 'Hello'
},
loading: false
};
}
and of course : no graph, an error on the js console :
TypeError: undefined is not a function
at Object.Xa.init (http://localhost:63342/www/js/highcharts.js:190:242)
at Object.Xa (http://localhost:63342/www/js/highcharts.js:15:293)
at link.m (http://localhost:63342/www/js/highcharts-ng.min.js:8:2964)
at link (http://localhost:63342/www/js/highcharts-ng.min.js:8:3058)
at http://localhost:63342/www/lib/ionic/js/ionic.bundle.js:15996:44
at nodeLinkFn (http://localhost:63342/www/lib/ionic/js/ionic.bundle.js:15605:13)
at compositeLinkFn (http://localhost:63342/www/lib/ionic/js/ionic.bundle.js:15009:15)
at nodeLinkFn (http://localhost:63342/www/lib/ionic/js/ionic.bundle.js:15599:24)
at compositeLinkFn (http://localhost:63342/www/lib/ionic/js/ionic.bundle.js:15009:15)
at compositeLinkFn (http://localhost:63342/www/lib/ionic/js/ionic.bundle.js:15012:13) <div id="chart1" config="chartConfig">
My questions :
If I put the dependency on
angular.module('myApp', ['highcharts-ng']).controller('Dashboard',....)
blank page, so I assume that it's on app.js only.... right or wrong ?
- How to solve my problem ?
PS : To JSFiddle or CodePen user, here is your graal : http://codepen.io/anon/pen/ateyI
Is not exactly my project but reproduce this problem. Thanks !