mercredi 9 août 2017

peekRecord not working

As a first page, I am loading the list of data's from store. once the user click on a list element, I am taking them for details view of the data. for that I am passing the param to next page and find the clicked data.

But I am not getting the peekRecord worked properly. actually I don't want to call the api again from the details view page.

here is my try:

import Ember from 'ember';

export default Ember.Route.extend({

    model: function(params) {
        var model = Ember.RSVP.hash({
                model: this.store.peekRecord('card-list', params.id )
            });
        console.log( "mode is", model );//
        return model;
    }
});

console gives me as part of the data values. it shows no.of field as null

{
  "_id": 271,
  "_state": 1,
  "_result": {
    "model": {
      "cardNo": "1234573005738",
      "cardName": "Platinum Credit Card",
      "selected": "",
      "selectedTenure": null,
      "applicationAmount": null,
      "oneTimeFee": "HKD 132.32",
      "selectedTransaction": null,
      "interestRate": "APR 15.33%",
      "cardDispName": null,
      "applnAmtDisp": null,
      "currencyCode": null,
      "selectedProduct": null,
      "appliedAPR": null,
      "balances": [
        "1"
      ],
      "tenures": [
        "6",
        "12",
        "18",
        "24"
      ],
      "transactions": [
        "21",
        "23"
      ]
    }
  },
  "_subscribers": []
}

UPDATE

goToNext: function() {

            var creditCard = this.controllerFor('cs2i.balance.balanceDetails').get('selCard');
            //console.log(this.controllerFor('cs2i.balance.balanceDetails').get('selCard'));
            this.controllerFor('cs2i.balance.balanceEdit').set('selCard', this.controllerFor('cs2i.balance.balanceDetails').get('selCard'));
            // this.controllerFor('balanceReview').set('selCard', this.controllerFor('cs2i.balance.balanceDetails').get('selCard'));
            // this.controllerFor('balanceConfirmation').set('selCard', this.controllerFor('cs2i.balance.balanceDetails').get('selCard'));
            console.log("id", creditCard.get("id") )
            this.transitionTo('cs2i.balance.balanceEdit', creditCard.get("id") );
        },




Aucun commentaire:

Enregistrer un commentaire