I developed a custom directive for the JustGage
plugin, here is how it looks:
function justGage() {
return {
restrict: 'E',
replace: true,
scope: {
universalId: '@',
dynamicValue: '='
},
template: '<div id="{{universalId}}" class="200x160px" style="margin-top: 5vh"></div>',
link: function ($scope, $element) {
var g = new JustGage({
id: $scope.universalId,
value: $scope.dynamicValue,
min: 0,
max: 100,
minLabelMinFontSize: 15,
maxLabelMinFontSize: 15,
valueMinFontSize: 40,
valueFontColor: '#ededed'
});
}
};
}
In my controller, I set values for the universalId
and dynamicValue
$element.universalId = "gauge";
$element.dynamicValue = $scope.data;
This is how my HTML structure appears.
<just-gage></just-gage>
However, when trying to render the gauge, I encounter an error message saying
"justgage : no element with id 0"
. Despite assigning identical ids in the template and JustGage object of my directive.
Do you have any suggestions on resolving this issue?