How can I add additional model properties after I find a model? (Or how can I access a route's params in setupController?
given a route
this.resource('gallery', { path:'/gallery/:gallery_id' });
and a router /routes/gallery.js
export default Ember.Route.extend({
model: function(params) {
return this.store.find('monkeys', { monkeyType: params.gallery_id });
//can I add an additional property to the returned model here?
},
setupController: function(controller, model) {
var pageTitle = 'something related to params.gallery_id';
//can I access route params in here?
this.controllerFor("application").set('pageTitle', pageTitle);
controller.set('model', model);
}
});
Ideally I want to set the pageTitle
property on the application controller to some gallery_id
specific string, which is not returned by the api service.
the api returns the following, based on the url /monkeys?monkeyType=someId
{ "monkeys":[{ ... }, { ... }] }