title: Angularjs - How to store the response received from $http.get?
body: <p>I have a json file. I want to get the data from that file using <code>$http.get</code> and store that in variable so that I can use it later in the controller. Something like this:    </p>
  
  <pre><code>$http.get('items.json').success(function(response){
      var data = response;    //data can't be used outside this function
  })
  </code></pre>
  
  <p>I want to use <code>data</code> outside the function.</p>