ember-link-action

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


Keywords
action, addon, combine, daniel, ember, ember-addon, kmak, kuzirashi, link, ember-cli, ember-cli-addon
License
MIT
Install
npm install ember-link-action@2.0.4

Documentation

Ember Link Action Build Status npm version Ember Observer Score

Greenkeeper badge

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 >= 3.0, >= 2.0 versions of Ember. Tests confirm that it works as expected with release, beta and canary.

For 1.13.13 compatibility use tested version: 0.0.37. In other cases - use the latest version.

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/.