jeudi 22 février 2018

Sending a Query Param to a nested route via Ember

I am trying to send a query parameter via a . This has been achieved elsewhere in the application as follows:



This correcctly send s the user to the cusomterSearch.results nested route with the customerNumber, dateFrom and dateTo params in the URL.

In this part of my application I am trying to achieve the same result in a link-to that goes to a paramterised route. The original link:

  

This is succesfull and takes the user to route mtlcustomer/:id

When I try to add the Query Param as follows:

  

The user is still taken to the mtlcustomer/:id route but without the query param appended.

The route for mtlcustomer/:id mirrors the successfull implementation earlier in the app:

  model(params) {
    let unitNumber = this.paramsFor('results').unitNumber
    let hash = { unitNumber }

    return Ember.RSVP.hash({
      medid: this.get('store').query('mtlcustomer', params, hash),
      mtlhistory: this.get('store').query('mtlcusthistory', params, hash),

    });
  },

  setupController(controller, models) {
    this._super(controller, models);
    controller.set('mtlcustomer', models.mtlcustomer);
    controller.set('mtlcusthistory', models.mtlcusthistory);


  },

The route code probably still needs refining but in the URL bar after the is clicked there is no customerNumber param.




Aucun commentaire:

Enregistrer un commentaire