mercredi 9 août 2017

Convert string to number in component

When I get the value from model I am getting like "HKD 112" - But I require to set back like 112 how to convert to Number in model?

here is my try:

import Ember from 'ember';

export default Ember.Component.extend({
    defaultBalanceType:"Please Select a Balance",
    defaultInstalment:"Please Select",
    payToAmount:null,
    monthlyInstalment(){
        this.get('selectedCreditCard.model').set("monthlyInstalment", parseInt(this.get('payToAmount')) );//not working gives `NaN`
    },
    actions:{
        selectedBalaceType:function( balance ){
            this.set("selectedBalance", balance );
            this.set("payToAmount", balance.get("amount"));
        },

        selectATunure : function( tunure ){
            this.set("selectedTunure", tunure);
            this.monthlyInstalment();
        }
    }
});




Aucun commentaire:

Enregistrer un commentaire