Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4827

Route transition with model from component

$
0
0

@ioanszabo wrote:

Hi,
I want to redirect to a route "recipe/2" for example from a component.

In order to do this I injected the router
router: Ember.inject.service("-routing")

in my component and then I've tried to redirect on click using this

this.get("router").transitionToRoute("/recipe/" + clicked.dataset.id);
(Assertion Failed: The route /recipe/2 was not found)

I also tried using
this.get("router").transitionToRoute("/recipe/", clicked.dataset.id);
(ember.debug.js:49883 Uncaught TypeError: objects.pop is not a function(…))

and this.get("router").transitionToRoute("/recipe/" , this.get("store").findRecord("recipe", clicked.dataset.id));
(ember.debug.js:49747 Uncaught TypeError: this.contexts.slice is not a function)

How should I do a redirect from component and why is not documented this very usual case? I mean, you have a component that searches for recipes for example and when the user hit click on one from search results you want to get him to that recipe. Is a usual case not some exception.

Thanks.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4827

Trending Articles