ps0604 ps0604 - 9 months ago 55
AngularJS Question

Dynamically creating mutiple Highcharts charts in Angular directive

In my directive template I have

<div id="chartdiv-{{name}}" style="width:100%;height:100%"></div>

where name is variable and assigned to each directive when it is created.

The chart is created with


But this doesn't work. Everything works fine if I don't use the
variable. Any ideas?

Answer Source

Change it like this,

<div id="{{ 'chartdiv-' + name }}"></div>


If you are creating template inside a directive, it should be

<div id="chartdiv-{{$}}"></div>