I have an Ember CLI application. I'm trying to access the Ember Data Store from a service (service name: users.js) like this:
console.log(this.store.peekAll('accounts').toArray());
I am calling this service from a route and when I do this, I get the following error:
Error while processing route: accounts Cannot read property 'peekAll' of undefined TypeError: Cannot read property 'peekAll' of undefined
I was able to access the Data Store from the route but not from the service. After some searching, I believe that this is how it works. How do I access the store from a service?
Aucun commentaire:
Enregistrer un commentaire