Search code examples
javascriptember.jsember-router

Ember explicit route


When I define a route explicitly, Ember fails to render the associated template. Do I have to specify in the route object the renderTemplate property every time I create an explicit route? Just to be more clear, here is my example:

define(['ember'],
    function(Ember) {
        "use strict";

        var DudeRoute = Ember.Route.extend({
            model: function() {
            },
            setupController: function() {
            },
            renderTemplate: function() {
            }
        });

        return DudeRoute;
    });

and if I specify in my app like this:

define([ ... ],
    function(
            Router,
            IndexRoute,
            DudeRoute,
            ApplicationController,
            IndexController
            ) {

        "use strict";

        /*Module Pattern*/
        var App = {
            LOG_TRANSITIONS: true,
            Router: Router,
            // Load routes
            IndexRoute: IndexRoute,
            DudeRoute: DudeRoute,
            //Load Controllers
            ApplicationController: ApplicationController,

            IndexController: IndexController
            //Load Models

            //Load Views

        };

        return App;
    });

The whole thing falls apart, it does not render my template. Though if I remove DudeRoute everything works fine.


Solution

  • OK, I figured it out. So My problem was, that I was using some automation to generate code for Route/Controller/View/templates. And what I did and you can see from the code too is that I stupidly set the renderTemplate method to do nothing. So by removing it it will work.