I'm using ember 2.12
Here's my route
import Ember from 'ember';
export default Ember.Route.extend({
rentalService: Ember.inject.service('rentals-service'),
model(){
this.get('rentalService').findRentals();
console.log('Inside route');
console.log(this.get('store'));
return this.get('store').findAll('rental');
}
});
Here's my ember rental-service
import Ember from 'ember';
export default Ember.Service.extend({
findRentals() {
console.log("Inside servce");
console.log(this.get('store'));
return "hello from servce";
}
});
Why is it I cannot access the ember-data on the rental-service? whenever I console .log this.get('store')
inside the rental-service it returns an undefined. However on the routes, whenever I console.log the same code it returns this value.
Does this mean I cannot perform a rest call using ember data inside a service?
I'm using Mirage to mock a web-server/http requests
Aucun commentaire:
Enregistrer un commentaire