Skip to content

e00dan/ember-link-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c856ef1 · Aug 6, 2016

History

35 Commits
Aug 6, 2016
Nov 24, 2015
Aug 6, 2016
Aug 6, 2016
Sep 30, 2015
Sep 30, 2015
Aug 6, 2016
Sep 30, 2015
Sep 30, 2015
Aug 6, 2016
Aug 6, 2016
Aug 6, 2016
Dec 23, 2015
Aug 6, 2016
Dec 23, 2015
Aug 6, 2016
Aug 6, 2016
Sep 30, 2015
Aug 6, 2016
Aug 6, 2016
Dec 23, 2015

Repository files navigation

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