In my component I have a observer
which is setting the max amount as a value. when I load the page it sets and all are fine.
In case if I use back of the browser and come again to page, I am getting default select
value instead of the sorted one.
how can i force my observer
to re-calculate on back transitions? ( back / front button )
here is my code :
onValueChange:Ember.observer('selectedCreditCard.requestAmount', function(){
var value = Number(this.get('selectedCreditCard.requestAmount'));
var that = this;
this.get("selectedCreditCard.tenureDetails").forEach(function(item,index){
if(value >= Number(item.min) && value <= Number(item.max)){
console.log("item.tenures", JSON.parse(JSON.stringify(item)) );
that.set('selectedCreditCard.matchingTenure', item.tenures );
that.set('selectedCreditCard.handlingFee', item.handlingFee );
that.set('selectedCreditCard.minAmount', 1500 );
//first time works. on page shuffle not works!!
that.set('selectedCreditCard.selectedTenure',
that.get('selectedCreditCard.matchingTenure').get('lastObject') );//setting value
//works based on above settings. so fails!!
that.monthlyInstalment();
}
})
}),
Aucun commentaire:
Enregistrer un commentaire