vendredi 25 septembre 2015

helper returning an object not scalar value expected

Thought I'd create a if-then-else helper which looks like this:

import Ember from 'ember';
export function ifThenElse(param, ifTrue, ifFalse=null) {
  return Boolean(param) ? ifTrue : ifFalse;
}

export default Ember.Helper.helper(ifThenElse);

And then when using my component I can do the following:

{{my-nifty-component class=(if-then-else pigsHaveWings 'wake-up' 'good-answer') }}

Well the problem I'm having is that my helper is not very helpful and the HTML/DOM result is:

<div class="[object Object] ember-view"></div>

Can someone please help me with my helper?




Aucun commentaire:

Enregistrer un commentaire