Conversation
The `renderView()` method now accepts render-level `partials` that are
merged with the instance-level and global Handlebars partials. The
option value is specified as object with the shape: `{partialName: fn}`
or a Promise of such an object.
Fixes #82
There was a problem hiding this comment.
I removed the merge of this.handlebars.helpers since Handlebars will do this merge automatically at render time.
|
+1 |
Add support for render-level partials
|
Released in |
|
Thanks for this feature, though I'm unsure of the exact syntax to use..
I've used {'mypartial':'path/to/my/partial/mypartial.hbs'} but this is only adding 'path/to/my/partial/template.hbs' as text in the place of the partial. How should we resolve this to an object or a promise of an object? Do you have an example? |
|
It is an promise that resolves to a map, you can use |
|
@nealshail It's a hash of {
foo: function () { /* compiled Handlebars template */ },
bar: function () { /* compiled Handlebars template */ }
} |
@caridy Not sure I follow…what are you thinking? |
|
@ericf we have a similar situation with MBR. It is just messy to have to create a bunch of promises (one per partial) then aggregate them into a map after calling |
|
@caridy would that be covered by what I wrote here #118 (comment)? |
|
@ericf that's a no go since |
|
Well the API currently provides what's needed to implement what you want, it sounds like the app needs an abstraction over this to create an more DLS-y API. I don't care if people have to write a loop/forEach to accomplish the complex use they have… |
The
renderView()method now accepts render-levelpartialsthat are merged with the instance-level and global Handlebars partials. The option value is specified as object with the shape:{partialName: fn}or a Promise of such an object.Fixes #82