Skip to content

Commit ed9b71e

Browse files
committed
Fixed a bug with ng-attr-id and dynamic ids not being passed through properly
1 parent 74cb566 commit ed9b71e

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

src/zingchart-angularjs.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,27 @@
77
return {
88
restrict : 'EA',
99
scope : {
10+
id : '@',
1011
zcValues : '=',
1112
zcJson : '=',
1213
zcRender : '='
1314
},
1415
controller : ['$scope', '$element', '$attrs', function($scope, $element, $attrs){
1516
var id;
16-
1717
// Get or generate id
18-
if(!$element.attr('id')){
18+
if(!$attrs.id){
1919
id = 'zingchart-auto-' + currentAutoId;
2020
currentAutoId++;
21-
$element.attr('id', id);
22-
} else {
23-
id = $element.attr('id');
21+
$attrs.id = id;
22+
}
23+
else{
24+
if($attrs.id.indexOf('{{') > -1){
25+
id=$scope.id;
26+
$element.attr('id', id);
27+
}
28+
else{
29+
id = $attrs.id;
30+
}
2431
}
2532

2633
var initializing = {

0 commit comments

Comments
 (0)