Closed jrjohnson closed 9 years ago
ember-breadcrumbs is a Component, so to understand this behavior I'm referring to the API docs: http://emberjs.com/api/classes/Ember.Component.html
It looks like the layout
property takes precedence over the layoutName
property. This means that if you want to provide a named layout, you need to set layout
to null.
I can understand this is really not obvious, so I'm definitely open to thinking of other ways to support this.
I tried all the paths I could think of to set layoutName and set layout to null and nothing worked. Or at least I couldn't get anything to fail in a way that let me move forward. I'm guessing it has something to do with this: https://github.com/emberjs/ember.js/issues/5499 I will try out the solution in that ticket and see if I can get it working and submit a PR.
@jrjohnson did you end up getting this working?
Here's how I ended up overriding the template:
BreadCrumbs.BreadCrumbsComponent.reopen({
layout: Ember.computed(function() {
return this.templateForName('components/mybreadcrumbs')
})
});
I would suggest updating the docs to show something like this instead of what you currently have.
I apologize for how much of a PITA it was to accomplish this. Thankfully a very nice solution has come along: ember-cli's addons. Ember-breadcrumbs v0.1.0+ fixes this issue.
@pmdarrow -- thank you! This is a general solution for adjusting the layout (i.e. template) of a component without changing the component itself. I agree that this is worth mentioning.
@DanChadwick you're welcome :smile:
I wasn't able to make layoutName call a template, but maybe thats not what it does? Is it possible to specify a handlebars file instead of a compiled string?