I need to insert the view & controller from the route categories
in multiple other routes, without nesting them in that categories
route (because I want to keep URLs independent).
So, I'm rendering the categories
template, into the main application
one, in the outlet topbar
using the controller I get from my existing categories
route.
App.PostRoute = Ember.Route.extend({
renderTemplate: function() {
this.render();
this.render('categories', {
outlet: 'topbar',
into: 'application',
controller: this.controllerFor('categories')
});
}
});
When I visit the categories
route, all's working fine! I can even browse other routes from there. But if I access first any other route, the categories
controller seems not to be created:
Assertion failed: The controller for route 'categories'' could not be found. Make sure that this route exists and has already been entered at least once. If you must intialize the controller without entering a route, use `generateController`.
Nice warning :) I wish all frameworks were that smart! So I'm trying to generate that controller manually... But how?
I tried:
App.CategoriesRoute.create().generateController('categories', App.Category)
and the static version:
App.CategoriesRoute.generateController('categories', App.Category)
It doesn't seem to be the right way to do. Any help please?