Skip to content

Commit

Permalink
I added the change into the 3.7 source by not the release source. (#615)
Browse files Browse the repository at this point in the history
This is in relation to issue emberjs/website#3850
previously merged using pull request #569
  • Loading branch information
sonic1981 authored and jenweber committed Mar 16, 2019
1 parent 939c39f commit 2ecc491
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions guides/release/templates/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,23 @@ pressed down.

## Allowing Default Browser Action

By default, the `{{action}}` helper prevents the default browser action of the
DOM event. If you want to allow the browser action, you can stop Ember from
preventing it.
By default, the `{{action}}` helper prevents the default browser action of the DOM event (i.e. going to `newPage.htm`). So, for example see the following standard `a` tag with an `action`:

For example, if you have a normal link tag and want the link to bring the user
to another page in addition to triggering an ember action when clicked, you can
use `preventDefault=false`:
```handlebars
<a href="newPage.htm" {{action "logClick"}}>Go</a>
```

**Clicking on this link does not go to `newPage.htm`** because the `action` has overridden this functionality. This is the default behavior for Ember.

You can override this behavior and make this work more like a standard, non-ember, anchor tag by using the `preventDefault=false` overload of the action on an `a` tag. For example:

```handlebars
<a href="newPage.htm" {{action "logClick" preventDefault=false}}>Go</a>
```

With `preventDefault=false` omitted, if the user clicked on the link, Ember.js
will trigger the action, but the user will remain on the current page.
This still triggers the `logClick` action but then **we also go to `newPage.htm`.**

With `preventDefault=false` present, if the user clicked on the link, Ember.js
will trigger the action *and* the user will be directed to the new page.
You can specify `preventDefault=true` and this reverts to the standard Ember functionality (see previous example).

## Modifying the action's first parameter

Expand Down

0 comments on commit 2ecc491

Please sign in to comment.