在 ember-cli 上设置 UserApp.io
Setting up UserApp.io on ember-cli
这看起来微不足道,但我一直没能成功。我已成功使用 UserApp.io 进行 user/authentication 管理。我最近使用 ember-cli 创建了一个 ember 应用程序,但尽管 ember 受到 UserApp.io 的支持,但我无法让两者一起工作。这里有说明(在没有 cli 的情况下与 ember 集成)。
https://github.com/userapp-io/userapp-ember
这是一个片段:
在您的 index.html 中包含 UserApp JavaScript 库和这个 Ember 模块。请务必将它们添加到 app.js 文件之前。
<script src="https://app.userapp.io/js/userapp.client.js"></script>
<script src="https://app.userapp.io/js/ember-userapp.js"></script>
(您也可以使用 bower 安装模块:$ bower install userapp-ember
)
启动模块
在 app.js 中的 App = Ember.Application.create();
上方使用您的应用程序 ID 添加此代码。
Ember.Application.initializer({
name: 'userapp',
initialize: function(container, application) {
Ember.UserApp.setup(application, { appId: 'YOUR-USERAPP-APP-ID' });
}
});
因为我正在使用 ember-cli,所以我在初始化文件夹中创建了一个名为 userapp.js
的文件,其中包含以下代码:
import Ember from 'ember';
export default {
name: 'userapp',
initialize: function(container, application) {
Ember.UserApp.setup(application, {
appId: 'USERAPP-ID-INSERTED-HERE',
loginRoute: 'login',
indexRoute: 'index',
heartbeatInterval: 20000,
usernameIsEmail: false
});
}
};
当我 运行 我的应用程序出现以下错误时:
Uncaught TypeError: Cannot read property 'setup' of undefined
我觉得这是某种东西 simple/stupid,但我这辈子都弄不明白。
您的应用似乎没有包含 ember-userapp.js
。如果您使用 bower 安装它,请编辑 Brocfile.js
以包含像
这样的库
app.import('bower_components/userapp-ember/ember-userapp.js');
这看起来微不足道,但我一直没能成功。我已成功使用 UserApp.io 进行 user/authentication 管理。我最近使用 ember-cli 创建了一个 ember 应用程序,但尽管 ember 受到 UserApp.io 的支持,但我无法让两者一起工作。这里有说明(在没有 cli 的情况下与 ember 集成)。
https://github.com/userapp-io/userapp-ember
这是一个片段:
在您的 index.html 中包含 UserApp JavaScript 库和这个 Ember 模块。请务必将它们添加到 app.js 文件之前。
<script src="https://app.userapp.io/js/userapp.client.js"></script>
<script src="https://app.userapp.io/js/ember-userapp.js"></script>
(您也可以使用 bower 安装模块:$ bower install userapp-ember
)
启动模块
在 app.js 中的 App = Ember.Application.create();
上方使用您的应用程序 ID 添加此代码。
Ember.Application.initializer({
name: 'userapp',
initialize: function(container, application) {
Ember.UserApp.setup(application, { appId: 'YOUR-USERAPP-APP-ID' });
}
});
因为我正在使用 ember-cli,所以我在初始化文件夹中创建了一个名为 userapp.js
的文件,其中包含以下代码:
import Ember from 'ember';
export default {
name: 'userapp',
initialize: function(container, application) {
Ember.UserApp.setup(application, {
appId: 'USERAPP-ID-INSERTED-HERE',
loginRoute: 'login',
indexRoute: 'index',
heartbeatInterval: 20000,
usernameIsEmail: false
});
}
};
当我 运行 我的应用程序出现以下错误时:
Uncaught TypeError: Cannot read property 'setup' of undefined
我觉得这是某种东西 simple/stupid,但我这辈子都弄不明白。
您的应用似乎没有包含 ember-userapp.js
。如果您使用 bower 安装它,请编辑 Brocfile.js
以包含像
app.import('bower_components/userapp-ember/ember-userapp.js');