Reputation: 984
I wish to load my View using a variable like this:
{{#if model.isLoaded }}
Loaded: {{ model.template.slug }}
{{ view App.DocumentView templateName="model.template.slug" }}
{{ else }}
Loading…
{{/if}}
Is there a way to pass variable to a View like this? How could I otherwise load it when my model gets updated?
Upvotes: 2
Views: 1282
Reputation: 2252
I created a library to help with this kind of issue, check at github
Upvotes: 0
Reputation: 3745
Use Binding to bind the template's name to your model's property.
{{#if model.isLoaded }}
Loaded: {{ model.template.slug }}
{{ view App.DocumentView templateNameBinding="model.template.slug" }}
{{ else }}
Loading…
{{/if}}
Upvotes: 3