title: Provider 'myService' must return a value from $get factory method
body: <pre><code>    app.factory('myService', function ($http) {
      var myService;
      var getData = function(link) { //function to get some data from a get request to 'link'
          $http.get(link)
              .success(function(response) {
                 myService = response.data;
           });
          return myService;
          };
          return myService;
      });
  </code></pre>
  
  <p>I am using two controllers,one to send a request to myService to get search results from a search and storing the results in myService and the other controller is of a different page (but same app) where I have to show the results. </p>
  
  <p>The controller below is to get search results and store them in myService:</p>
  
  <pre><code>app.controller('headerController', ['$scope', function($scope,$http,myService) {
      $scope.search_it=function(name,link) { //this is called from html, providing the name and link arguments, with link containing the link to get data from
          $scope.respons = myService.getData(link);   
      };     
  }]);
  </code></pre>
  
  <p>The controller below is to get data from myService to view on another page:</p>
  
  <pre><code>    app.controller("resultController", function ($scope,myService) {
          $scope.resJSON = myService;
      });
  </code></pre>
  
  <p>Where is my problem? And if the code is incorrect then mention where.</p>