I have moved into latest Ember version 1.9.1 and Handlebars version 2.0.0. In this, I am getting an error like "Usage of Ember.Handlebars.get is deprecated, use a Component or Ember.Handlebars.makeBoundHelper instead."
I have a code like this,
Handlebars.registerHelper('ifCond', function (temp_v1, operator, temp_v2, options) { // No I18N
var v1,v2;
v1 = Ember.Handlebars.get(this, temp_v1, options);
v2 = Ember.Handlebars.get(this, temp_v2, options);
if( v1 == undefined ){
v1 = temp_v1;
}
if( v2 == undefined ){
v2 = temp_v2;
}
switch (operator) {
case '==':
return (v1 == v2) ? options.fn(this) : options.inverse(this);
case '!=':
return (v1 != v2) ? options.fn(this) : options.inverse(this);
default:
return options.inverse(this);
}
});
Here, I need to check the given string value is equal or not. If I remove the "Handlebars" in Ember.Handlebars.get(this, temp_v1, options), that deprecation error will be gone. But I couldn't get the original value of temp_v1.
JSBIN LINK: JSBIN LINK
Aucun commentaire:
Enregistrer un commentaire