I ran into the following problem when creating a router based application with emberjs. My application is simplified, structured as follows:
var App = Em.Application.create({});
App.ApplicationController = Em.Controller.extend({});
App.ApplicationView = Em.View.extend({
template : Em.Handlebars.compile('APPLICATION TEMPLATE')
});
App.RootState = Em.Route.extend({
index : Em.Route.extend({
route : "/"
})
})
App.Router = Em.Router.extend({
root : App.RootState
});
App.initialize();
App.RootState.reopen({
login : Em.Route.extend({
route : "/state1"
})
});
App.RootState.reopen({
alarms : Em.Route.extend({
route : "/state2"
})
});
As shown in my application, I am trying to extend the router with new routes at runtime. I know that there is another topic with a similar question, but the example being discussed does not work for me. How can I extend the router at runtime with additional routes without calling initialize () after each ... reopen ({}).
The background for this is to determine at runtime what the application looks like, for example, to connect different wigets with their own routes.
Regards, T
source
share