Is it possible for many routes to share the same controller?


Is it possible for many routes to share the same controller without creating there own?

(one use case will be a signup form with many stages)

as answered in similar question:

I know that I can do this:

App.LocationsEditRoute = Ember.Route.extend({

setupController: function(controller, model) {
renderTemplate: function() {

but it seems that App.LocationsEditController is exist in the memory anyway, and just replace by another later. it it possible to prevent its creation in the first place?


I haven’t tried this out but it looks like you can now define what controller a route uses via controllerName

From the RC7 release notes:

Routes can now specify their controller class name with controllerName


What a Timing!

I made a small test but it not seems to work:

maybe I’m not using it right… () {
  this.resource('signup', { path : '' } , function () {
    this.route('step1', { path : 'step1' });
    this.route('step2', { path : 'step2' });

App.SignupStep1Route = Ember.Route.extend({
  controllerName : 'SignupStep2Controller'

App.SignupStep1Controller = Ember.ObjectController.extend({
  test : 'test 1'

App.SignupStep2Controller = Ember.ObjectController.extend({
  test : 'test 2'


First to see your jsbin in action, you need to have an application template with an {{outlet}} to act as a placeholder for other templates.

Updated jsbin

But there seems to be some tweaks with the Route#controllerName which breaks it. Will have a deeper look at the code once


After going through the code part, found that there is something missing in the following lines

while setting the controller context to the template.

On searching on the emberjs commits and issues, found that the following pull request has not been merged yet which is the root cause of the issue.


Many Thanks for the affort @SelvaG