Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Action helper:</strong></p> <p>The answer can be found in official guide:<br> Specify the type of event: <a href="http://emberjs.com/guides/templates/actions/" rel="nofollow">http://emberjs.com/guides/templates/actions/</a></p> <pre><code>&lt;p&gt; &lt;button {{action "select" post on="mouseUp"}}&gt;✓&lt;/button&gt; {{post.title}} &lt;/p&gt; </code></pre> <p>List of available event: <a href="http://emberjs.com/guides/understanding-ember/the-view-layer/#toc_adding-new-events" rel="nofollow">http://emberjs.com/guides/understanding-ember/the-view-layer/#toc_adding-new-events</a></p> <hr> <p><strong>LinkTo helper:</strong></p> <p>As <code>{{linkTo}}</code> doesn't have an <code>on</code> option like <code>{{action}}</code>, this helper can simulate the same result by define the <code>eventManager</code> property.</p> <pre><code>Ember.Handlebars.registerHelper('linkAction', function (name) { var options = [].slice.call(arguments, -1)[0]; var params = [].slice.call(arguments, 1, -1); var hash = options.hash; hash.namedRoute = name; hash.currentWhen = hash.currentWhen || name; hash.parameters = { context: this, options: options, params: params }; var LinkView = Ember.LinkView.extend({ didInsertElement: function () { this.eventManager = Ember.Object.create({}); this.eventManager.click = function () { return false; }; this.eventManager[hash.on] = function (e, v) { Ember.LinkView.prototype.click.call(v, e); } } }) return Ember.Handlebars.helpers.view.call(this, LinkView, options); }); </code></pre> <p>How to use:</p> <pre><code>{{#linkAction route on="mouseEnter"}}Text{{/linkAction}} </code></pre> <p>Demo: <a href="http://jsfiddle.net/indream/mKVU8/1/" rel="nofollow">http://jsfiddle.net/indream/mKVU8/1/</a></p> <p>Reference: <a href="https://github.com/emberjs/ember.js/blob/v1.0.0-rc.3/packages/ember-routing/lib/helpers/action.js" rel="nofollow">Action helper</a> <a href="https://github.com/emberjs/ember.js/blob/v1.0.0-rc.3/packages/ember-routing/lib/helpers/link_to.js" rel="nofollow">LinkTo helper</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload