I'm using both pods and routable components (thanks to PR #11939) in my application. I would love for the route.js definition for each routable component to sit next to the component itself, just like you can do with controllers. For example, I structure my routable component home as follows:
app
pods
components
home
component.js
route.js
template.hbs
I then map the route:
this.route('components/home', {path: '/'});
In route.js I render the home component using renderTemplate:
export default Ember.Route.extend({
renderTemplate: function () {
this.render({component: 'home'});
}
});
However, the component object is never actually created, as the conditional (
|
if (!template && !ViewClass && Component && isGlimmerComponent) { |
) is not entered because
template is defined. This is because the route and the template have the same path. The template is rendered, but without using
component.js.
I would have thought that, if component is defined in the options passed to the render method AND that component exists and satisfies the requirements (is a glimmer component), it should prefer the component and not fallback to the template.
I suggest that !template is removed from the conditional statement, or at least ignored if component is defined in the options and the component matches routable component requirements.
I'm using both pods and routable components (thanks to PR #11939) in my application. I would love for the
route.jsdefinition for each routable component to sit next to the component itself, just like you can do with controllers. For example, I structure my routable componenthomeas follows:I then map the route:
In
route.jsI render thehomecomponent usingrenderTemplate:However, the component object is never actually created, as the conditional (
ember.js/packages/ember-routing/lib/system/route.js
Line 2151 in 7c8d59a
templateis defined. This is because the route and the template have the same path. The template is rendered, but without usingcomponent.js.I would have thought that, if
componentis defined in the options passed to the render method AND that component exists and satisfies the requirements (is a glimmer component), it should prefer the component and not fallback to the template.I suggest that
!templateis removed from the conditional statement, or at least ignored ifcomponentis defined in the options and the component matches routable component requirements.