vendredi 21 septembre 2018

Display only positive values in Ember handlebar

Following the answer for question Check for a value equals to in Ember Handlebar If block helper I run

ember generate component greater-than-zero

In components/greater-than-zero.js I have put:

import Ember from 'ember';

export default Ember.Component.extend({
    isGreaterThanZero: function() {
      return this.get('param') > 0;
    }.property('param')
});

and in templates/components/greater-than-zero.hbs:


  


I am trying to use as:


    


The problem is that nothing is displayed. If I leave only in templates/components/greater-than-zero.hbs, then all myvarss are displayed. So I think the handlebar is recognized and the problem is with the isGreaterThanZero function. Here if add console.log(this.get('param')); before the return statement, it prints undefined to the console.

I am new to Ember, so maybe I miss some elementary thing.




Aucun commentaire:

Enregistrer un commentaire