mercredi 6 janvier 2016

Ember link-to doesn't match if

I for the life of my can't figure out why this isn't working

{{#if params.link}}
    {{#link-to params.link}}
        {{fa-icon icon=params.icon}}
        {{#if params.label.left}}<span class="label label-left">{{params.label.left}}</span><i class="triangle triangle-right"></i>{{/if}}
        {{#if params.text}}<span class="text">{{params.text}}</span>{{/if}}
        {{#if params.label.right}}<i class="triangle triangle-left"></i><span class="label label-right">{{params.label.right}}</span>{{/if}}{{/if}}
    {{/link-to}}
{{else}}
    <button {{action params.action}}>
        {{fa-icon icon=params.icon}}
        {{#if params.label.left}}<span class="label label-left">{{params.label.left}}</span><i class="triangle triangle-right"></i>{{/if}}
        {{#if params.text}}<span class="text">{{params.text}}</span>{{/if}}
        {{#if params.label.right}}<i class="triangle triangle-left"></i><span class="label label-right">{{params.label.right}}</span>{{/if}}{{/if}}
    </button>
{{/if}}

Using ember 2.2.0, ember-data 2.2.0 and ember-cli 1.13.13

If someone can help me fix this issue that would be great! Also the code duplication bothers me, thoughts on how I could clean this up? (maybe other than making a component?)




Aucun commentaire:

Enregistrer un commentaire