阅读背景:

从$ http迁移到Restangular,测试失败

来源:互联网 

I have the following controller:

我有以下控制器:

'use strict';

angular.module('App')
  .controller('LoginCtrl', function ($scope, $state, Login, localStorageService, Message, authService) {

    $scope.submit = function() {
      if (this.username) {
        var credentials = {
          username: this.username,
          password: this.password
        };

        Login.post(credentials).then(function(data) {
            if (data.status === 200) {
                authService.loadCustomer(data.data);
                $state.go(authService.nextPath() || 'curator');
            }
        },
        function(data) {
          if (data.status === 401) {
            $scope.password = '';
            Message.error('Wrong e-mail/password combination');
          }
          else {
            Message.error('An error occured while logging in.');
          }
        });
      }
    }
});
'



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: