[Chartjs]-How to write with good practice?

2👍

Ideally you should do otherwise and call the javascript methods to draw chart via angularJs

.controller('DashboardController', function ($scope) {
    $scope.getChartLabels = function() {
        return ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"];
    }

    $scope.getChartData = function() {
        return [12, 19, 3, 5, 2, 3];
     }

    drawCharts($scope.getChartLabels,$scope.getChartData);
}

    function drawCharts(d1,d2){
      // draw charts here.
    }

Leave a comment