If I'm trying to pass my controller value in the customized handlabber in the condition helper. But I am not able to get value inside my assistant
I am updating my controller scope value, which comes from my Ajax response. The scope will vary on requirement as 0,1,2,3
In my HBS,
{{ifcond controller.scope '==' '0' }} // do something here {{/ IfCond}} {{#ifcond controller.scope '==' '1'}} // do something here {{/ Ifcond}} {{#ifcond controller.scope '== '' 2 '}} // Do something here {{/ IfCond}} {{#ifcond controller.scope' == '' 3 '}} // Here in my helper class, Ember.Handlebars.registerHelper ('ifcond', function (temp_v1, operator, temp_v2, option) {// no I18N var v1, v2; v1 = Ember.Handlebars.get (this, temp_v1, option); v2 = Ember.Handlebars.get (this, temp_v2, option); if (v1 == undefined) {v1 = temp_v1;} if (v2 == undefined) {v2 = Temp_v2;} switch (operator) {case '==': return (v1 == v2) options.fn (this): options.inverse (this); default: return options.inverse (this);}}) ;
console.log (v1); // This 'scope' prints, but '0' or '1' or '2' or '3' is required.
My console always prints the raw value of v1, but I need the evaluation value of V1.
How to do this?
No comments:
Post a Comment