title: How to pass GET response data to POST Request
body: <p>I am new using Angularjs and I am having an issue while parsing a JSON response. I am doing client side authentication for the <strong>login page</strong> and I have used <code>get</code> request to fetch data from servers side and <code>post</code> request for client side. 
  HTML code :</p>
  
  <pre><code>    &lt;form ng-submit="loginform(logcred)" class="ng-scope ng-pristine ng-valid center" name="logform"&gt;&lt;br/&gt;&lt;br&gt;
  &lt;tr ng-repeat="logcred in serverinfo"&gt;&lt;/tr&gt;
  &lt;div&gt;
    &lt;label form="emailinput"&gt;&lt;b&gt;Email&lt;/b&gt;&lt;/label&gt;
    &lt;input type="email" class="form-control" name="uname" id="emailinput" placeholder="you@example.com" ng-model="logcred.username" &gt;
  &lt;/div&gt;
  
  &lt;div&gt;
    &lt;label form="pwdinput"&gt;&lt;b&gt;Password&lt;/b&gt;&lt;/label&gt;
    &lt;input type="password" class="form-control" name="pwd" id="pwdinput" placeholder="*******" ng-model="logcred.password"&gt;
  &lt;/div&gt;
  
  &lt;div&gt;
      &lt;button type="cancel" class="btn" ng-click="toggle_cancel()"&gt;Cancel&lt;/button&gt;
      &lt;button class="btn btn-primary" ng-click="submit()"&gt;Login&lt;/button&gt;
  &lt;/div&gt;
  &lt;br/&gt;   
  &lt;/form&gt;
  </code></pre>
  
  <p>AngularJS code :</p>
  
  <pre><code>var myApp = angular.module('myApp', []);
    myApp.controller('credientials', function($scope, $http) {
              /* server side response*/
    $http.get('http://localhost:3000/loginfo
    .then(
    function successCallback(response){
    $scope.serverinfo = response.data;
    });       
  
  /* client-side response*/
  
  $scope.loginform = function(serverinfo,username,password){
    $http({
          url: 'http://localhost:3000/loginfo',
          method: 'POST',
          data: {
              "username" :username,
              "password" :password,
              }
          })
          .then(
          function successCallback(response){
          console.log(response);
          if (serverinfo.username === response.data.username &amp;&amp; serverinfo.password === response.data.password) { 
          $scope.signinfo = response.data;
          }else{
              console.log("Error: " + response)
          }
      });
  }
  </code></pre>
  
  <p>Problem what I am facing is, I need to send the <code>GET</code> response data into <code>POST</code> request and there I am doing the condition check, if the username and password matches, it's should give success meassage. But I am not sure my thinking is right or not.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Any help / advice would be greatly appreciated.</p>