peekRecord不工作

时间:2017-08-07 13:22:55

标签: javascript ember.js

作为第一页,我正在从商店加载数据列表。一旦用户点击列表元素,我就会将它们带到详细数据视图中。因为我正在将参数传递到下一页并找到点击的数据。

但我没有让peekRecord正常工作。实际上我不想再从详细信息视图页面调用api了。

这是我的尝试:

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将我作为数据值的一部分。它将no.of字段显示为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": []
}

更新

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") );
        },

0 个答案:

没有答案