Combine linkTo and action helpers in Ember.js

后端 未结 8 1965
隐瞒了意图╮
隐瞒了意图╮ 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:45

    Ember Link Action addon

    This is OK for SEO solution!

    Install addon

    ember install ember-link-action
    

    Usage

    You can pass closure action as invokeAction param to {{link-to}} component:

    {{#link-to 'other-route' invokeAction=(action 'testAction')}}
      Link to another route
    {{/link-to}}
    

    To pass parameters to action you can use:

    {{#link-to 'other-route' invokeAction=(action 'testAction' param1 param2)}}
      Link to another route
    {{/link-to}}
    

    Compatibility

    Automated test suite confirms that addon works with 1.13 up to latest Ember 3 releases.

    It works with a release, beta and canary versions of Ember.

    Addon GitHub repository. Contributions are welcome.

提交回复
热议问题