In previous versions of Ember, I used a singular PostController
to manage new/show and edit views.
But now with the separation of controllers and routes and the convention of using post.new/post.edit/post
controllers, I'm not sure what the convention for sharing the logic across views.
Bear in mind my edit/new routes aren't nested inside the posts
route because the outlets aren't nested so I can't put the logic in a parent route.
- Do I override the controller in the route and use my old singular controller?
- Do I use
{{with controllers.post}}
block inside the handlebars template? - Do I use a shared mixin between
PostNewRoute/PostEditRoute
andPostNewController/PostEditController
? - Do I inherit
PostEditController
fromPostNewController
? - Wrap all the post routes inside a route who's template is simply
{{outlet}}
so I can inherit shared events? - Something else I've missed?
I doubt there's a proper convention for this yet, but I'd like to hear how other people are doing it?