Sibi John
Sibi John

Reputation: 485

Ember : How can i create routes and controllers at runtime?

I have to dynamically create routes and controllers based on the parameters i receive at run time. I cannot create routes beforehand because there are simply too many routes that use the same code with minor differences. Is this possible? If so, how?

The problem I a trying to solve : My application has a tabbed ui with routing. That is, each tab points to a new route. I have divided my modules into different routes. Each route has its own controller and so on. Now the issue is, each module can act differently according to the configuration that I receive from the database. Users need to be able to open the same module in different tabs but this is not possible because one route represents a module and since controllers are singleton, two instances of the same module cannot exist simultaneously.

Upvotes: 0

Views: 118

Answers (1)

Sibi John
Sibi John

Reputation: 485

I converted my modules (which were previously hosted on separate routes) to components and then used a tabbing construct to open each module on a click action in a separate tab. In this scenario since each module is a component i was able to open multiple instances of the same module.

Upvotes: 1

Related Questions