gpt4 book ai didi

javascript - Angular.js 常量问题?

转载 作者:行者123 更新时间:2023-11-30 16:06:42 26 4
gpt4 key购买 nike

我有点困惑,我正在按照本教程尝试让 autheictaion 工作。 https://devdactic.com/user-auth-angularjs-ionic/

我卡在了第一阶段

这是我的 app.js

// create main module, adding dependencies for ionic, angular router, angular  mock and apps own modules

var jailbreak = angular.module('jailbreak', ['ionic', 'ui.router', 'map', 'chat', 'constant'])

jailbreak.run(function(AUTH_EVENTS) {
document.getElementById('debug').innerHTML = JSON.stringify(AUTH_EVENTS);
})

然后这是我的constants.js

angular
.module('constant', [])
.constant('AUTH_EVENTS', {
notAuthenticated: 'auth-not-authenticated',
notAuthorized: 'auth-not-authorized'
})
.constant('USER_ROLES', {
admin: 'admin_role',
public: 'public_role'
});

最佳答案

这可能是语法错误,您在模块声明后有一个分号,但随后您尝试将 .constant 链接到它上面。

改变这个:

var constants = angular.module('constant', []);

进入这个:

var constants = angular.module('constant', [])

关于javascript - Angular.js 常量问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36942028/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com