Skip to content

Commit ba0efb3

Browse files
committed
Support to render chart once angularDOM compilation is completed.
This only halts the rendering part of fusioncharts until angular execution finishes.
1 parent abab760 commit ba0efb3

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/angular-fusioncharts.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
// SOFTWARE.
22-
22+
var counter = 0;
2323
(function() {
2424
var fc = angular.module('ng-fusioncharts', []);
2525

@@ -358,8 +358,15 @@
358358
if (chart && chart.dispose) {
359359
chart.dispose();
360360
}
361-
chart = new FusionCharts(chartConfigObject).render();
362-
scope[attrs.chartobject] = chart;
361+
chart = new FusionCharts(chartConfigObject);
362+
363+
angular.element(document).ready(function(){
364+
element.ready(function(){
365+
// Render the chart only when angular is done compiling the element and DOM.
366+
chart = chart.render();
367+
scope[attrs.chartobject] = chart;
368+
});
369+
});
363370
},
364371
dataStringStore = {},
365372
i,
@@ -448,4 +455,4 @@
448455
}
449456
};
450457
}]);
451-
}());
458+
}());

0 commit comments

Comments
 (0)