Skip to content

Latest commit

 

History

History
65 lines (42 loc) · 1.79 KB

README.md

File metadata and controls

65 lines (42 loc) · 1.79 KB

Ember Link Action Build Status npm version Ember Observer Score

An Ember CLI addon. Allows to combine {{link-to}} helper with firing an action.

It is useful when you want to fire an action at the same time when user transitions to other route by clicking {{link-to}}. It is OK for SEO solution.

Usage

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

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

You can also use string name instead of closure action:

{{#link-to 'other-route' invokeAction='testAction'}}
  Link to other route
{{/link-to}}

To pass parameters to action you can use:

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

Compatibility

Addon works with >= 2.0 versions of Ember. Tests confirm that it works as expected with release, beta and canary.

Installation

Run following Ember CLI command in your project directory:

ember install ember-link-action

Contributing - Installation

  • git clone this repository
  • npm install
  • bower install

Contributing - Running

Contributing - Running Tests

  • ember test
  • ember test --server

Contributing - Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.