title: How to pass values to Angular JS Service
body: <p>I have implemented to Edit and Display values on text boxes etc but now want to transfer these code to Angular JS Service.Here is my code- </p>
  
  <pre><code>app.factory('fetchEmpService', ['$rootScope', '$http', function ($rootScope, $http ) {
      var employees = [];
      return {
  
          editEmp: function (EID) {
              debugger;
              for (i in $rootScope.employees) {
                  if ($rootScope.employees[i].EmpId == EID) {
                      $rootScope.newemployee = {
                          EmpId: $rootScope.employees[i].EmpId,
                          Name: $rootScope.employees[i].Name,
                          Age: $rootScope.employees[i].Age,
                          City: $rootScope.employees[i].City,
                          Gender: $rootScope.employees[i].Gender
                      };
                  }
              }
          },
  
  
      };
  }]);
  </code></pre>
  
  <p>I am using $rootScope instead of $scope (previously used in controller) object. Is it correct way because its returning nothing.</p>