title: Better design for passing data to other ng-view's and persisting it across controllers
body: <p>I started developing in AngularJS. I'm confused as to whether this is a proper design to pass data between my partial views.</p>
  
  <p>Right now I have a loader page where I do some request.</p>
  
  <pre><code>function PeopleController($scope,$http,$location){
      $http.get('/location/-79.18925/43.77596').
      success(function(data){
        $scope.savePeopleResponse(data);
        $location.url('/test');
      });
  }
  </code></pre>
  
  <p>Then in the view that gets loaded for /test</p>
  
  <p>I am just calling</p>
  
  <pre><code>&lt;div ng-controller="resultController"&gt;
      &lt;div class="blueitem"&gt;{{getResultForPeople()|json}}&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>[resultController]</p>
  
  <pre><code>    function resultController($scope){
        $scope.getResultForPeople = function(){
       return $scope.getPeopleResponse();
      }
  }
  </code></pre>
  
  <p>and the savePeopleResponse and getResultForPeople are "cached" in the rootScope as such</p>
  
  <pre><code>app.run(function($rootScope) {
    var peopleResponse = {};
    $rootScope.savePeopleResponse = function(data) {
     peopleResponse = data;
     console.log(data);
    }
  
    $rootScope.getPeopleResponse = function(){
      return peopleResponse;
    }
  });
  </code></pre>
  
  <p>Now as you can see, this will get very messy if this application grows larger and larger. What's the best way to handle data so that it's persisted across controllers?</p>