繁体   English   中英

模块解析失败错误意外令牌}-Webpack

[英]Module parse failed error Unexpected token } - Webpack

我不确定为什么会收到此错误

ERROR in ./login/loginController.js
Module parse failed: /Users/leon/Projects/admin/login/loginController.js Line 66: Unexpected token }
You may need an appropriate loader to handle this file type.
|             console.log('login failed!');
|         }
|     }
| }
|
 @ ./entry.js 16:22-59

这是我的entry.js文件

这是loginController(第66行是以下代码中的最后一个结束}

var loginController = angular
    .module('loginController', [])
    .controller('LoginCtrl', LoginCtrl);

LoginCtrl.$inject = [
    '$rootScope',
    '$scope',
    '$location',
    '$timeout',
    'ApiFactory',
    'AUTH_EVENTS',
    'AuthFactory'];

function LoginCtrl(
    $rootScope,
    $scope,
    $location,
    $timeout,
    ApiFactory,
    AUTH_EVENTS,
    AuthFactory) {

    /** Init LoginCtrl scope */
    /** --------------------------------------------------------------------- */
    var vs = $scope;
        vs.login = login;

    $rootScope.$broadcast(AUTH_EVENTS.loginSuccess);

    $rootScope.$on(AUTH_EVENTS.notAuthenticated, function (event, data) {
        $rootScope.currentUser = null;
        $scope.currentUser     = null;
        AuthFactory.logout();
        $location.path('/login');
    });

    function login(credentials) {
        console.log('credentials',credentials);
        AuthFactory.login(credentials).then(function (user) {
            $rootScope.$broadcast(AUTH_EVENTS.loginSuccess);
            $scope.setCurrentUser(user);

            if (user.password_reset) {
                $location.path('/password');
            } else {
                $location.path('/tickers');
            }
        }, function () {
            // $scope.loginData.message = "Invalid Username/Password";
            $rootScope.$broadcast(AUTH_EVENTS.loginFailed);
            console.log('login failed!');
        }
    }
}

module.exports = loginController;

我认为您的问题是AuthFactory.login(credentials).then(function (user) { ,看起来好像没有)关闭了此方法调用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM