mercredi 3 janvier 2018

How to carry some data between page using model in Ember?

I am trying to carry some data by updating the ( adding ) some properties to existing model. But it's not carried to next page. so i tried like this:

combineArray:Ember.computed(function(){

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

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

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

            card.get('cardtransactions').map(function(transaction){

                console.log( 'transaction', JSON.stringify(transaction) )

                let temp = {};
                temp = JSON.parse(JSON.stringify(  transaction ));
                temp.cardName = name;
                temp.cardNum = numb;
                temp.selected = false;
                temp.handlingFee = that.setHandlingFee( transaction.get('localCurrencyAmount') );
                trans.push( Ember.Object.create().setProperties(temp) );

            })

        });

        this.model.set('processedTrans', trans  );

        console.log( this.model.get('processedTrans').get('firstObject'));

        return this.model.get('processedTrans');

    }),

Using the above approach I am finding that, some of data's are missing. so what is the correct way to carry some data between page?

Using service not sets for me. because I have no.of pages. I am looking to update a model with required datas.




Aucun commentaire:

Enregistrer un commentaire