title: How to update global variable after http call Angular
body: <p>I have a global variable which I need to update after http get call. After update I need to pass this updated variable to other function. I can't understand what is the best way to do this. Here is my code:</p>
  
  <pre><code>    app.controller('myCtrl', function($scope, $http) {
       var data = '';
       $http.get("data.json")
         .then(function(response) {
          data = response.data;
       });
       vm.mapOptions = {
          controls: {
              navigator: false
          },
          center: [40, -35],
          zoom: 3,
          layers: [{
              style: {
                  fill: {
                      color: '#1996E4'
                  },
                  stroke: {
                      color: '#FFFFFF'
                  }
              },
              type: 'shape',
              dataSource: data
          }],
          shapeCreated: onShapeCreated,
          shapeFeatureCreated: onShapeFeatureCreated
      };
      });
  </code></pre>
  
  <p>Is it possible at all to update global variable after http call?</p>
  
  <p>Thank you for help in advance. </p>