Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/angular-fusioncharts.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
var fc = angular.module('ng-fusioncharts', []);


fc.directive('fusioncharts', ['$http', function($http) {
fc.directive('fusioncharts', ['$http',function($http) {

return {
scope: {
width: '@',
Expand All @@ -47,9 +48,11 @@
rows: '@',
columns: '@',
map: '@',
markers: '@'
markers: '@',
id:'@'
},
link: function(scope, element, attrs) {

var observeConf = {
// non-data componenet observers
NDCObserver: {
Expand Down Expand Up @@ -361,9 +364,8 @@
/* @todo validate the ready function whether it can be replaced in a better way */
angular.element(document).ready(function(){
element.ready(function(){
// Render the chart only when angular is done compiling the element and DOM.
chart = chart.render();
scope[attrs.chartobject] = chart;
scope[attrs.id] = chart;
});
});
},
Expand Down Expand Up @@ -401,8 +403,8 @@
eventsObj[key] = scope.$parent[attrs[attr]];
}
}


//fix for container id not compiled before rendering in dynamic templates issue RED-2012
element[0].id=scope.id===undefined?element[0].id:scope.id;
chartConfigObject = {
type: attrs.type,
width: attrs.width,
Expand All @@ -417,6 +419,7 @@

for (observableAttr in observeConf.NDCObserver) {
attrConfig = observeConf.NDCObserver[observableAttr];

if (attrConfig.ifExist === false || attrs[observableAttr]) {
attrs.$observe(observableAttr, attrConfig.observer);
}
Expand Down Expand Up @@ -449,8 +452,7 @@
}
}

createFCChart();

createFCChart();
}
};
}]);
Expand Down