lundi 29 décembre 2014

Why is keyword not being rendered?

I've got the following. All works well. But {{keyword}} in app/templates/search/results.hbs is not being rendered at all...


Any pointers?



// app/router.js
import Ember from 'ember';
import config from './config/environment';

var Router = Ember.Router.extend({
location: config.locationType
});

Router.map(function() {
this.resource('search', { path: '/search' }, function() {
this.route('results', { path: ':keyword' });
});
};

// app/routes/application.js
import Ember from 'ember';

export default Ember.Route.extend({
actions: {
search: function(keyword) {
this.transitionTo('search.results', keyword);
}
}
});

// app/routes/search/results.js
import Ember from 'ember';

export default Ember.Route.extend({
model: function(params) {
return Ember.RSVP.hash({
products: this.store.find('product', { name: params.keyword, status: 'available' })
});
}
});

// app/templates/application.hbs
<form {{action "search" keyword on="submit"}}>
{{input type="text" value=keyword placeholder="search" class="search"}}
</form>

// app/templates/search/results.hbs
<h3>Searching "{{keyword}}"</h3>
{{product-list products=products action='addToCart' fromRoute='index'}}




Aucun commentaire:

Enregistrer un commentaire