jeudi 12 janvier 2017

The same model but not the same query params could not set in one route by ember

My ember version:

---------------------------
 Ember             : 2.10.2
 Ember Data        : 2.10.0
 jQuery            : 2.2.4
 Ember Simple Auth : 1.1.0
 Model Fragments   : 2.3.2
---------------------------

My route code like:

import Ember from 'ember';
import RSVP from 'rsvp';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';

export default Ember.Route.extend(AuthenticatedRouteMixin, {
  model() {
    return RSVP.hash({
      orderTransactionTypes: this.store.query('transactionType', {
        filter: {
          category: 'order_category'
        }
      }),
      otherTransactionTypes: this.store.query('transactionType', {
        filter: {
          category: 'transaction_category'
        }
      })
    });
  },

  setupController(controller, model) {
    controller.set('model', model);
  }
})

In RSVP.hash all data come from transactionType, but they have not same query params. I use this way set model will have a problem is model. orderTransactionTypes and model.otherTransactionTypes become same data.

Whey this problem is happened? And how can I fix this problem? Thanks.




Aucun commentaire:

Enregistrer un commentaire