Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple routers in ember.js?

Tags:

ember.js

In my app I have a requirement for a functional area to open in an overlay such that it sits on top of the current route which could be almost any other route in the app.

This functional area will have it's own routes as it contains at least a master-detail view.

What is the current best practice for dealing with this situation?

Is it possible to have top-level routes that don't tear down the current route/views when entering them? If not and it's necessary to have the ApplicationController (or similar) handle the globally accessible overlay, what's the best way to achieve router-like functionality for that area?

like image 645
Kevin Ansfield Avatar asked May 07 '13 09:05

Kevin Ansfield


People also ask

How does Ember routing work?

At every level of nesting (including the top level), Ember automatically provides a route for the / path named index . To see when a new level of nesting occurs, check the router, whenever you see a function , that's a new level.

What is outlet in Ember JS?

Here is the explanation: {{outlet}} -> This will provide a stub/hook/point into which you can render Components(Controller + View). One would use this with the render method of routes. In your case you will likely have a details route which could look like this.

What is a model in Ember?

In Ember Data, models are objects that represent the underlying data that your application presents to the user. Note that Ember Data models are a different concept than the model method on Routes, although they share the same name.


1 Answers

I think you got confused by open in overlay requirement and you are trying to solve non-existing problem.

Opening messaging functionality in another page in your app or opening it as overlay on top of the app is just a design thing that should be handled by CSS and existing app router. Just create messaging route, controller, etc.

You didn't say that, but in case you want to boot separate application there, the best approach is to open it in the iframe. New app, new lifecycle, etc. Again, how you display it inside another app is just matter of CSS.

like image 175
Wojciech Bednarski Avatar answered Oct 13 '22 11:10

Wojciech Bednarski