I was looking through the ember-htmlbars package and discovered this util for determining if a component is available? http://ift.tt/1Q8wcMT
Is there any way to use this from my app? I'm building a dashboard-type interface and some of the dashboard widgets have optional actions. In essence I'd like to do something like:
<div class="panel panel-default">
<div class="panel-body">
{{component model.displayComponent model=model}}
</div>
{{#if isComponent(model.actionComponent) }} <!-- this would be a property -->
<div class="panel-footer">
{{component model.actionComponent model=model}}
</div>
{{/if}}
</div>
My fallback is to put a blank action component for each of my widgets that don't have one, but it would be cleaner to be able to check to see if they exist first.
Aucun commentaire:
Enregistrer un commentaire