I'm using higtcharts-ng to make some graphs,I just wrote an angular directive which called mchart
to wrap it.
there is the code:
'use strict';
angular.module('MyApp')
.directive('mchart',function(){
return {
templateUrl : 'scripts/directives/chart/mchart.html',
restrict : 'E',
replace : true,
controller : 'mChartCtrl',
scope:{
'type':'@',
'num':'@',
'col':'@',
'title':'@',
'chartID':'@',
'chartConfig':'@',
'icon':'@'
}
}
})
and the template
code :
<div class="col-sm-{{col}} col-md-{{col}}">
<section class="panel b-a">
<div class="panel-heading no-border bg-{{type}} lt">
<span class="pull-right badge dk m-t-sm">{{num}}</span>
<span class="h4 text-lt m-t-sm m-b-sm block font-bold"><i class="fa fa-{{icon}}"></i> {{title}}</span>
</div>
<div class="panel-body">
<div id="b-c" class="text-center">
<div class="inline" data-bar-color="#afc5de" data-track-color="#f2f4f8" data-scale-color="false" style="width: 150px; height: 250px; line-height: 150px;">
<highchart id="{{chartID}}" config="{{config}}"></highchart> //not working here
</div>
</div>
</div>
</section>
</div>
I got some errors from the console when I put it on my home page like this:
<mchart col="4" num="152" title="total" type="primary" icon="bug"
chartID="chart1" config="chart1Conf"></mchart>
errors:
Syntax Error: Token '{' invalid key at column 2 of the expression
[{{chartConfig}}] starting at [{chartConfig}}].
{{}}
expr is not supported in config
attr. But I don't know how to deal with it