title: Changes made to the global variable inside a function is not available to another function in angularjs
body: <p>I have 2 scope functions and have declared one global scope variable.
  I have made the changes for the global variable in one function but it is not reflected in the other function in angularjs . </p>
  
  <p>The scenario is like I have a checkbox in table and have written a function where values will be pushed to the <code>$scope.selection=[];</code> if the checkbox is checked. </p>
  
  <p>I have another delete button which is calling delete function and the delete operation will be performed with the value stored in the array.But I am getting the empty array instead of the modified one when I give <code>console.log()</code> inside the delete function. Kindly let me know your suggestions.</p>
  
  <p>Code:</p>
  
  <pre><code>$scope.selectionlist = [];
  $scope.selectitem = function(itemselected){ 
      if(itemselected.isChecked === true) {        
        $scope.selectionlist.push(itemselected.xyz); 
      } 
  }
  $scope.deletememo = function(){
      console.log("selection inside deletememo",$scope.selectionlist.length);      
  }
  </code></pre>