title: TypeError: $http.post(...).success is not a function
body: <p>After clicking on register button the site is showing success is not a function error.
  its not getting registered because of it
  please help!</p>
  
  <p>This is the error</p>
  
  <pre><code>    angular.js:14525 TypeError: $http.post(...).success is not a function
      at b.$scope.register (chirpapp.js:63)
      at fn (eval at compile (angular.js:15358), &lt;anonymous&gt;:4:144)
      at e (angular.js:26994)
      at b.$eval (angular.js:18161)
      at b.$apply (angular.js:18261)
      at HTMLFormElement.&lt;anonymous&gt; (angular.js:26999)
      at HTMLFormElement.dispatch (jquery.min.js:3)
      at HTMLFormElement.q.handle (jquery.min.js:3)
  (anonymous) @ angular.js:14525
  (anonymous) @ angular.js:11008
  $apply @ angular.js:18266
  (anonymous) @ angular.js:26999
  dispatch @ jquery.min.js:3
  q.handle @ jquery.min.js:3
  </code></pre>
  
  <p>This is my app.js</p>
  
  <pre><code>var app = angular.module('chirpApp', ['ngRoute']).run(function($rootScope){
       $rootScope.authenticated = false;
    $rootScope.current_user = ''; 
  });
  
  
  app.config(function($routeProvider){
    $routeProvider
      //the timeline display
      .when('/', {
        templateUrl: 'main.html',
        controller: 'mainController'
      })
      //the login display
      .when('/login', {
        templateUrl: 'login.html',
        controller: 'authController'
      })
      //the signup display
      .when('/register', {
        templateUrl: 'register.html',
        controller: 'authController'
      });
  });
  
  app.controller('mainController', function ($scope) {
      $scope.posts = [];
      $scope.newPost = {
          created_by: '',
          text: '',
          created_at: ''
      };
  
      $scope.post = function () {
          $scope.newPost.created_at = Date.now();
          $scope.posts.push($scope.newPost);
          $scope.newPost = {
              created_by: '',
              text: '',
              created_at: ''
          };
      };
  });
  
  app.controller('authController', function($scope, $http, $rootScope, $location){
    $scope.user = {username: '', password: ''};
    $scope.error_message = '';
  
    $scope.login = function(){
      $http.post('/auth/login', $scope.user).success(function(data){
        if(data.state == 'success'){
          $rootScope.authenticated = true;
          $rootScope.current_user = data.user.username;
          $location.path('/');
        }
        else{
          $scope.error_message = data.message;
        }
      });
    };
  
    $scope.register = function(){
      $http.post('/auth/signup', $scope.user).success(function(data){
        if(data.state == 'success'){
          $rootScope.authenticated = true;
          $rootScope.current_user = data.user.username;
          $location.path('/');
        }
        else{
          $scope.error_message = data.message;
        }
      });
    };
  });
  </code></pre>
  
  <p>After clicking on register button the site is showing success is not a function error.
  its not getting registered because of it
  please help!
  ckech "authcontroller" the error is in register so it might be in $scope.register=function(...)</p>