Ember.js new routing api

I am currently porting my application from ember 1.0.0-pre2 to 1.0.0-pre4 and am having problems with the new routing API.

My use case does not seem to be covered in the new manuals in the documentation.

I always have a conversation div on the side next to the rest of the application, my application template looks something like this:

 <script type="text/x-handlebars" data-template-name="application"> <div id="main-content"> <aside> {{outlet chat}} </aside> {{outlet main}} </div> </script> 

When the old conf router matches the URL on both controllers and their respective outputs.

 Router : Ember.Router.extend({ root: Ember.Route.extend({ index: Ember.Route.extend({ route: '/', connectOutlets: function(router, event) { router.get('applicationController').connectOutlet('main', 'main'); router.get('applicationController').connectOutlet('chat', 'chat'); } }) }) 

How can I port this code to a new API or change the way I encoded this if this is a bad design for Ember.

I think I can summarize my question, how can we use the new routing API to map multiple controllers, taking care of different parts of the page, with the same URL.

thanks

+4
source share
1 answer

Performs an example according to the documentation [1].

 App.Router.map(function() { this.resource('index', {path: '/'}); }); App.IndexRoute = Ember.Route.extend({ renderTemplate: function(controller, model) { this.render('main', {outlet: 'main'}); this.render('chat', {outlet: 'chat'}); } }); 

[1] - http://emberjs.com/guides/routing/

+2
source

All Articles