-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request to support { model: my_model } in this.render() on a route #1820
Comments
You should be able to do: @controllerFor( 'dashboardMenuitems' ).set('content', controller.workspaces)
@render 'dashboardMenuitems', { into: 'dashboard', outlet: 'menu' } I'm not comfortable adding additional sugar quite yet. We can revisit shortcuts for Ember 1.1 once we see a lot more real-world usage. Thanks for your feedback. I will keep it in mind when we circle back around! |
@wycats Doing so will require the |
I believe that render accepts the model now (relatively recent change, not sure which stable version it will be in). |
[FEATURE ember-routing-add-model-option] is available since 1.6.0-beta.1 |
@selvagsz - thank you! |
There was some discussion about it in #1635 (and maybe others), I'd like to provide more use cases for this. Namely, in my existing code (~230 lines of coffeescript for routing), supporting that { model: ... } syntax would reduce my code by ~10%.
I'll post vast majority of my routing code below, so you can see yourself - and probably point me few code smells along the way, too ;) Especially, that I'm putting too much into renderTemplate() instead of using setupController().
The vast majority of the cases I'm using several render() calls in renderTemplate() are:
Basically my dashboard views have {{outlet main}} and {{outlet menu}}, which gets populated with various things.
In the snippet below, about 20 lines out of 130 is just to substitue { model: } behaviour. Interestingly, in the old router, connectOutlet() was doing the 'right' thing - in this point of view, new router introduced degradation (but, overall my code was 20% shorter after porting to the new router anyway!).
So, here is about 50% of my code (I did cut about half of the routes, almost all the events and transitions, too):
The text was updated successfully, but these errors were encountered: