Chartjs-Function returns undefined in AngularJS

0👍

getValue($scope.selectedItem.key,$scope.trendValues); is run before the callback inside TrendChartFactory is run.

You need to put this instruction inside it.

TrendChartFactory.get( {
  Item: $scope.selectedItem.key, 
  puItem: $scope.puName},function(data){

    $scope.trendValues = data;                          
    console.log($scope.trendValues);
    getValue($scope.selectedItem.key,$scope.trendValues);

});

Leave a comment