I have build a factory to handle the functions for my controller, but somehow the controller returns an error on one of the functions:
Error: Auth.getUser(...).success is not a function
@http://localhost:8080/app/controllers/mainCtrl.js:10:1
...
I have no idea what's going on here, the rest of the functions seem to be working fine?
main controller:
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');
});
};
});
question from:
https://stackoverflow.com/questions/33531336/angularjs-error-success-is-not-a-function 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…