Combine linkTo and action helpers in Ember.js

后端 未结 8 1959
隐瞒了意图╮
隐瞒了意图╮ 2020-12-13 13:50

I need to combine linkTo and action helpers in Ember.js. My code is:

{{#link-to \'index\'}}Clear{{/link-to}}
         


        
8条回答
  •  遥遥无期
    2020-12-13 14:44

    None of these combinations will work in Ember.js, but you do not need to combine these two helpers. Why don't you just use action helper and let it bubble to controller or route? There you can use transitionToRoute in controller or transitionTo in route.

    For example in controller you could have code like this:

    App.PostsController = Ember.ArrayController.extend({
        clear: function () {
            // implement your action here
            this.transitionToRoute('index');
        }
    });
    

提交回复
热议问题