transitionToRoute('route') From Inside Component

后端 未结 6 1134
逝去的感伤
逝去的感伤 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:48

    You could pass the controller in via a binding and then access it inside your component like so:

    {{image-editor currentControllerBinding="controller"}}
    
    App.ImageEditorComponent = Ember.Component.extend
      ...
      actions:
        delete: ->
          App.Files.removeObject(object)
          @get('currentController').transitionToRoute('images')
      ...
    

提交回复
热议问题