I need some guidance on implementing an angularjs google column chart. Specifically, I have a requirement to transfer the value from one JavaScript function to another variable defined in a separate JavaScript function.
Here is an example snippet of code from myController.js:
var globalID;
app.controller('myChart',['$rootScope','$scope','$uibModal','myService',function($rootScope,$scope,$uibModal,myService) {
$scope.chart = {};
$scope.chart.options = {
"title": "Summary API Tests",
'fontSize': '12',
"isStacked": "true",
colors: ['blue', 'cyan', 'red'],
axisFontSize : 8,
};
$scope.chart.type = "ColumnChart";
$scope.function2= function( event ) {
alert('in function2');
/* want to assign the value of val from below lines to globalID */
/* globalID = val; */
};
/* I want to invoke below lines in $scope.chartClick*/
$scope.function1= function (selectedItem) {
$scope.chart.data.rows[selectedItem.row].c[0].v;
val = $scope.chart.data.rows[selectedItem.row].c[0].v;
alert("inside function1: " + val);
};
//some more logic below
});
In the given JavaScript file, my goal is to pass the value of `val` from `$scope.function1` to `globalID` inside `function2`.