achambers / ember-cli-cookie Goto Github PK
View Code? Open in Web Editor NEWWrap $.cookie in Ember goodness
Wrap $.cookie in Ember goodness
As README says:
I ran:
npm install --save-dev ember-cli-cookie
And then I created a file named ember-cookie.js in /app/initializers in which the initializers would be loaded, and put
/*
/app/initializers/ember-cookie.js */
export default {
name: 'ember-cookie',
after: ['cookie'],
initialize: function(container, app) {
app.inject('controller', 'cookie', 'cookie:main');
}
}
And console outputed:
Error: Assertion Failed: No application initializer named 'cookie'
runvendor.js:13376
applyvendor.js:31555
runvendor.js:30173
runInitializevendor.js:15613
firevendor.js:3237
fireWithvendor.js:3349
readyvendor.js:3561
completedvendor.js:3592
me:23
I'm new to EmbeJS, did I misunderstand anything?
Hello,
Your example got .get()
is missing a token =
I think on line this.cookie.get('my-key');
Also, how can I pass in an expiration date / time and check it? Is that just e.g. this.cookie.set('foo', 'bar', {expires: 1})
?
DEPRECATION: The initialize
method for Application initializer 'cookie' should take only one argument - App
, an instance of an Application
. [deprecation id: ember-application.app-initializer-initialize-arguments] See http://emberjs.com/deprecations/v2.x/#toc_initializer-arity for more details.
ember-cli-cookie
seems to be making an assumption about where bower is installed, but I can't find where to fix this. I'm getting an error if I'm using a project-specific bower instead, e.g. ./node_modules/.bin/bower
.
Binary is fine; exiting
npm ERR! Linux 3.16.0-24-generic
npm ERR! argv "node" "/home/nnyby/node_modules/.bin/npm" "install"
npm ERR! node v0.10.33
npm ERR! npm v2.1.4
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: `bower install`
npm ERR! Exit status 127
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is most likely a problem with the ember-cli-cookie package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! bower install
npm ERR! You can get their info via:
npm ERR! npm owner ls ember-cli-cookie
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/nnyby/src/wacep/media/WeatherRoulette/npm-debug.log
I'm trying to use this plugin in my app, but I'm getting the above error when I try to inject the cookie into my routes.
This is my initializer, at app/initializers/token-cookie.js
import Ember from 'ember';
export default Ember.Application.initializer({
name: "token-cookie",
after: ['cookie'],
initialize: function(container, application) {
application.inject('route', 'cookie', 'cookie:main');
}
});
it's copied almost directly from the npm page, but it's blowing up immediately.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.