jeudi 19 septembre 2019

My ember application fully reload when I add a queryParam in a transitionTo

I am doing a search based on the data entered by a user in a search form and redirecting to a route with this data as queryParam and this reloads the application completely.

I make the transition like this: 'search' is the data entered by the user.

this.get('router').transitionTo('private.route1', { queryParams: { search: search } });

In the controller of the destination route I have declared this queryParam

export default Controller.extend({
    queryParams: ['search'],
});

and there I do an API search based on this queryParam. Everything works fine but when I do a transitionTo to this route, for some reason the symbol '?' is added at the beginning of the path of my route and this reloads the page.

The result I expected is that the transition is made the url looks like this and the application don't fully reload: http://localhost:4200/#/private/route1?search=userdata

And the real result is:

http://localhost:4200/?#/private/route1?search=userdata

with the symbol '?' in the beginning of the path, which causes the application to fully reload.




Aucun commentaire:

Enregistrer un commentaire