mercredi 3 janvier 2018

Not able to update the model in `afterModel`

In existing model, I am trying to add some values in it in the afterModel hook. But I am not finding in the model at all. How to do this?

here is my try :

afterModel:function(model,transition){

        var that = this;
        let trans = Ember.A();

        model.get('ccList').forEach(function(card,num){

            let cname = card.get('cardName');
            let numb = card.get('cardNum');

            card.get('cardtransactions').map(function(transaction){
//adding some values
                transaction.set('cardName', cname );
                transaction.set('cardNum', numb );
                transaction.set('selected', false );
                transaction.set('handlingFee', "" );

                trans.push( transaction );

            });
        });

        model.set('processedTrans',trans); //assigning back 

        console.log( JSON.stringify( model.get('processedTrans').get('firstObject'))); //but not getting here

    },




Aucun commentaire:

Enregistrer un commentaire