title: AngularJS : How to pass model data to service?
body: <p>This is my controller</p>
  
  <pre><code>blogApp.controller('myController',
  ['$scope', 'myService', function ($scope, myService)
  {
      $scope.logIn = myService.loginUser($scope.checkUser);
  };
  }]);
  </code></pre>
  
  <p>This is my view</p>
  
  <pre><code>&lt;div&gt;
      &lt;input type="text" ng-model="checkUser.username"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is my service</p>
  
  <pre><code>blogApp.service('myService', function ($rootScope)
  {    
     this.loginUser = function() {
     someAPI.logIn(checkUser.username);
   }
  </code></pre>
  
  <p>It is showing error that checkUser is not defined.</p>
  
  <p><strong>Update</strong>: I updated my service code as follows:</p>
  
  <pre><code>this.loginUser = function(checkUser) {
         someAPI.logIn(checkUser.username);
       }
  </code></pre>
  
  <p>It is still not working.</p>