Skip to content

Fix container id not compiled in dynamic templates #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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