I have a chart in my application that looks like this:
<canvas id="line" class="chart chart-line" height="250" width="{{width_chart}}" chart-data="data" chart-labels="labels" chart-series="series" chart-options="options" chart-colors="colors" chart-dataset-override="datasetOverride" chart-click="onClick" ng-show="isChecked()"> </canvas>
Within the isChecked function, I need to retrieve the ID of the canvas, which is "line" in this case. Then I need to check if this ID exists in an array within $scope, and based on its presence, return true or false to show/hide the chart.
$scope.isChecked = function() {
console.log('I am in the isChecked function');
console.log(this);
// Some code
return true;
};
My issue is that I cannot access the ID within the function using any method. The "this" keyword is also not functioning as expected. I tried the directive approach mentioned in the link below, but it did not work either.
Pass element using ng-show AngularJS
Any assistance would be greatly appreciated.