title: how to validate a response Angular function?
body: <p>I am learning Angular scopes and other stuff. Curently working on a system with authentication. </p>
  
  <pre><code>$scope.logUserIn = function(){
        $http.post('api/user/login', $scope.login).success(function(response){
  
          localStorage.setItem('User-Data', JSON.stringify(response));
          $scope.loggedIn=true;
  
        }).error(function(error){
          console.log(error);
        });
      }
    }
  </code></pre>
  
  <p>So, want to validate <strong>response</strong> because if i put some fake e-mail or a password response by the server pending .....forever. 
  Error function does not fires when i put some fake creditials.</p>