title: Why can't I use $rootScope instead of $scope?
body: <p>HTML file is this :</p>
  
  <pre><code>   &lt;!DOCTYPE html&gt;
  &lt;html lang="en" ng-app="myApp"&gt;
  
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
  
    &lt;title&gt;HTTP Request&lt;/title&gt;
  
    &lt;script src="angularjs"&gt;&lt;/script&gt;
    &lt;script src="appjs"&gt;&lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
          &lt;div ng-controller="myCtrl1"&gt;
              First Name: &lt;input type="text" ng-model="fname" required&gt;
              Last Name: &lt;input type="text" ng-model="lname" required&gt;
              &lt;button ng-click="search()"&gt;Send HTTP Request&lt;/button&gt;
              &lt;p&gt;Searching for : {{fname}} {{lname}}&lt;/p&gt;
              &lt;p&gt;Response Status: &lt;/p&gt;
              &lt;p&gt;{{status}}&lt;/p&gt;
              &lt;p&gt;Data: {{data}}&lt;/p&gt;&lt;br&gt;
              &lt;p&gt;Total number of results : {{data.numResults}}&lt;/p&gt;
          &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I have written a controller as :</p>
  
  <pre><code>var myApp = angular.module('myApp', []);
  
  myApp.controller('myCtrl1', ['$rootScope', '$http', function($rootScope, $http) {
      $rootScope.fname = "";
      $rootScope.lname="";
      $rootScope.search = function() {
  
          var search_url = "/search?fname=" + $rootScope.fname + "&amp;lname=" + $rootScope.lname;
          alert (search_url);
  //      alert("/search?fname=" + $scope.fname + "&amp;lname=" + $scope.lname);
          $http({method:'GET', url:search_url})
          .success(function(data, status, headers, config) {
              $rootScope.status = status;
              $rootScope.data = data;
              $rootScope.headers = headers;
              $rootScope.config = config;
          });
      };
  }]);
  </code></pre>
  
  <p>But it shows url in alertbox as : /search?fname=&amp;lname=
  But when I use $scope everywhere instead of $rootScope, it works fine (alert window shows url properly /search?fname=john&amp;lname=player).
  Need help to understand $rootScope in details. Thanks.</p>