I'm working on angularjs google column chart. My requirement is to assign the value from one javascript function to the other variable defined in other javascript function.
example code snippet for 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 above js file, i want to assign the value of val from $scope.function1 to globalID inside function2.