EmberJS: How to transition to a router from a controller's action

前端 未结 3 1965
迷失自我
迷失自我 2021-02-02 00:30

I have an action:

{{action create target=\"controller\"}}

which I have targeted to the bound controller (rather than the router) like this:

3条回答
  •  春和景丽
    2021-02-02 01:00

    Use transitionToRoute('route') to redirect inside an Ember controller action:

    App.AddBoardController = Ember.Controller.extend({
        create: function(){ 
            ...
            //TODO: Redirect to route
            this.transitionToRoute('route_name');
        }
    ...
    

提交回复
热议问题