我对Ember很新,并使用Ember-CLI,但我正在尝试使用jQuery cookie设置一个私有令牌进行登录,但它没有定义。如果我正在做凉亭/西兰花的话,请告诉我。大多数凉亭的东西都是脚手架Ember-CLI应用程序的一部分:
bower.json
{
"name": "my_app",
"dependencies": {
"jquery": "^1.11.1",
"ember": "1.10.0",
"ember-data": "1.0.0-beta.15",
"ember-resolver": "~0.1.12",
"loader.js": "ember-cli/loader.js#3.2.0",
"ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
"ember-load-initializers": "ember-cli/ember-load-initializers#0.0.2",
"ember-qunit": "0.2.8",
"ember-qunit-notifications": "0.0.7",
"qunit": "~1.17.1",
"bootstrap-sass-official": "~3.3.4",
"fontawesome": "~4.3.0",
"jquery-cookie": "~1.4.1"
}
}
Brocfile
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var app = new EmberApp();
app.import('bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js');
app.import("bower_components/jquery-cookie/jquery.cookie.js");
module.exports = app.toTree();
我已经尝试过(在Controller和Chrome控制台中):
$.cookie()
和
Ember.$.cookie()
但对于我得到的两个:
Uncaught TypeError: undefined is not a function