E
E
Ekaterina2015-04-28 07:23:57
Ember.js
Ekaterina, 2015-04-28 07:23:57

How to dynamically load a route in EmberJS?

It is necessary that when entering the search string - there is a transition to a new route
/search/string, respectively, the route path, for example /search/:q
What is the best way to do this?
If in the template {{input value=str}} and in the controller this.transitionToRoute, then you need to load the model in the controller (i.e. duplicate with loading in the route).
There is this.transitionToRoute('/search/' + str) option, but I don't like it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Romanov, 2015-04-29
@sferrka

Why don't you like transitionToRoute?
I would do it through the parameters - /search?q=lorem+ipsum
I didn't quite understand about the duplication of the model, in this version it should not be.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question