samedi 25 novembre 2017

Ember TransitionTo with queryParams not working

I'm new to ember and I'm trying to use transitionTo with queryParams but I can't get it to work I tried a lot of the solution but I can't find out what is wrong with my code. here the code for the two routes I'm to transition between:

1- index.js:

export default Ember.Route.extend({
 setupController: function(controller, model) {
 this._super(controller, model);
 controller.set("model", model);
 },
 model() {
  return {
   searchQuery: ""
  };
 },
 actions: {
  search() {
   const query = this.controller.get("model.searchQuery");
   this.transitionTo("/search-results", {
     quaryParams: {
       q: query
     }
   });
  }
 }
});

2-search-results.js:

export default Ember.Route.extend({
 model() {
  return {
   fieldsInput: []
  };
 },
 setupController: function(controller, model) {
  this._super(controller, model);
  controller.set("model", model);
 }
});

I don't know if anything else should be added. I tried setting queryParams on the controller but it didn't work either. also, I tried adding

  queryParams: {
   q: ""
  },

to the search results route but no use.




Aucun commentaire:

Enregistrer un commentaire