title: AngularJS error .success is not a function
body: <p>I have build a factory to handle the functions for my controller, but somehow the controller returns an error on one of the functions:</p>
  
  <blockquote>
    <p>Error: Auth.getUser(...).success is not a function
    @<a href="http://localhost:8080/app/controllers/mainCtrl.js:10:1" rel="noreferrer">http://localhost:8080/app/controllers/mainCtrl.js:10:1</a><br>
    ...</p>
  </blockquote>
  
  <p>I have no idea what's going on here, the rest of the functions seem to be working fine?</p>
  
  <p>main controller:</p>
  
  <pre><code>angular.module('mainCtrl', [])
  .controller('mainController', function($rootScope, $location, Auth) {
      var vm = this;
      vm.loggedIn = Auth.isLoggedIn();
      $rootScope.$on('$routeChangeStart', function() {
          vm.loggedIn = Auth.isLoggedIn();
          Auth.getUser()
              .success(function(data) {
                  vm.user = data;
              });
      });
      vm.doLogin = function() {
          Auth.login(vm.loginData.username, vm.loginData.password)
              .success(function(data) {
                  $location.path('/users');
              });
      };
  });
  </code></pre>