I have created a service in using ember-cli like so:
import Ember from 'ember';
export default Ember.Service.extend({
/**
* Returns true if the user is logged in
* @return {Boolean} true if the user is logged in
*/
isLoggedIn() {
return localStorage.token != null;
},
...remainder of class omitted for brevity...
});
when I try to inject it into a controller like so:
User: Ember.inject.service('user');
The object that is returned has none of the attributes or methods of the user service. The services guide says nothing about needing to do anything other than the above, though I noticed that you can call Ember.inject.service('wibble') and it still returns an Ember object (personally I think an exception would help here).
Does anyone know how I can get the service to inject correctly?
Aucun commentaire:
Enregistrer un commentaire