A component has didInsertElement, why doesn’t the router template have something similar? I am trying to know when the route has rendered it’s template HBS file. I am a little tired of putting in a component into a HBS just as boiler plate. Why are router templates even any different to component.js? Shouldn’t a router just render a component?
Yes I could again put in a component, but really why should I have to?
I think you’re absolutely right — this is probably how it should be. Components in Ember came onto the scene way after Routes & Controllers, so there’s a little bit of backwards compatibility being maintained here. In addition, the solution (“Routable Components”) has not landed yet and it’s not exactly clear when it will as it seems to have taken a backseat to Glimmer2. The shorter term solution, while somewhat boilerplate-y, is to do exactly what you’re doing.
export default Ember.Component.extend( /* stuff */ )
I can’t remember where I picked this up! Probably on slack.
Thanks Alex Speller How do you know about it out of interest?