I am working on an addon. I try to use partial. In my addon/templates/components/form.hbs I got {{partial "pane"}}
. My _pane.hbs is in addon/templates folder but ember can't find it:
Uncaught Error: Assertion Failed: Unable to find partial with name "pane".
I also tried to put _pane.hbs in addon/templates/components but no luck. Where should I put it to get picked up by ember?
As mentioned here, everything is dasherized in Ember CLI. Use a dash instead of an underscore.
Also, I think the partial
helper resolves starting in the templates
directory. If you want to store a partial in the components
directory, you'll probably have to make that explicit.
So your file should be named:
addon/templates/components/-pane.hbs
And your call should look like:
{{partial 'components/pane'}}
Templates under addon/templates
do not get included in the standard Ember build chain, and aren't found by the standard Ember resolver. This is why you have to manually import templates and assign them to as the layout in your component.
If you want to use a partial in your addon you will have to place it under app/templates
. This is unadvisable however as not only will the partial not be precompiled with your addons templates, it will pollute the root application's template namespace.
This will probably be addressed by upcoming versions of ember-cli, addons are going to be changing significantly soon.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With