Can someone help me in approach for passing Angular Variable to Google Chart Function which is present in the same Java Script with Angular Directive
And Also I wanted to load Google Charts to load only after passing the values.I just read some question they mentioned something like Promises How can i use here.
Java Script
In Below Code I wanted to pass Angular Variables openCount,closedCount to Google Chart Function like with Angular JS
Demo For Google Chart with Angular JS
In the above Demo I am hard coding the values
"rows": [
{c: [
{v: "Defect Opened"},
{v:1}
]},
{c: [
{v: "Defects Closed"},
{v: 2}
]
Now instead of hard coding values I wanted to pass the values from below controller. How can I achieve this[What modification required for this]
var app = angular.module('defectApp', ["ngTable"]);
app.controller('defectController', [
'$scope',
'$http',
function($scope, $http) {
$http({method: 'POST', url: '/angular/defect/defect.php'}).success(function(response) {
$scope.post = response;
console.log(response);
var openCount = $filter('filter')(response.data, {status: 'Open'}).length,
closedCount = $filter('filter')(response.data, {status: 'Closed'}).length,
assignedCount = $filter('filter')(response.data, {status: 'Assigned'}).length;
console.log(openCount);
})
},
]);
drawSarahChart
?openCount,closedCount
openCount
andclosedCount
todrawSarahChart
incontroller
afteropenCount
andclosedCount
get assigned?google.charts.load('current', {'packages':['corechart']}); // Draw the pie chart for Sarah's pizza when Charts is loaded. google.charts.setOnLoadCallback(drawSarahChart);