transitionToRoute('route') From Inside Component

后端 未结 6 1181
逝去的感伤
逝去的感伤 2021-01-04 02:18

How do I transition to a route pragmatically from inside a component action?

I tried to use @get(\'controller\').transitionToRoute(\'images\'

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-04 02:51

    A component is supposed to be isolated from its context, so while you could pass in a reference to the controller, that's probably outside the scope of what a component is for. You might want to just stick with using a view with its own controller instead. Check out Views Over Components - An Ember Refactoring Story.

    From Ember.js, Sending Actions from Components to Your Application, there's discussion about sending actions from a component up the route hierarchy.

提交回复
热议问题