samedi 21 février 2015

Calculate sum of 2 ember.js properties

I have a function which has 2 parameters which are properties of Ember objects, as given below:



mathOp: function(){

if (this.get('operator') == '+'){
var result = this.get('opr1') + this.get('opr2');
alert(result);
}

}


I am entering opr1 = 12, and opr=23 (for example). The addition is adding them as strings, i.e. result = 1223. How do I get them to add normally, i.e. make result = 35? Please help.





Aucun commentaire:

Enregistrer un commentaire