I have two models - make and car. I have an application that shows all of the makes (manufacturers) and then another model that shows the models or cars. I have set up dynamic segment for slugs in the URL and I want to filter the makes by the slug which happens to be the niceName
property.
route make.js
import Ember from 'ember';
export default Ember.Route.extend({
model(params) {
// find make by niceName using params.slug
const niceName = params.slug;
// find cars by make
return this.store.filter('make', function(item) {
return item.get('niceName') === niceName;
}).then( function(result) {
console.log( result.get('niceName')); // undefined
});
}
});
I have checked and it does correctly match those items with the same niceName
. I can check the length and if I play with the value of niceName
, it does change the length of what is returned.
The problem is that what is returned doesn't have any of the properties. If I attempt to show this in the view, it returns undefined as well.
What is filtering returning?
Aucun commentaire:
Enregistrer un commentaire