HTMLBars

Ember.HTMLBars Class

Module: ember-glimmer

makeBoundHelper (fn) private

Defined in packages/ember-glimmer/lib/make-bound-helper.js:8
Available since 1.10.0

Create a bound helper. Accepts a function that receives the ordered and hash parameters from the template. If a bound property was provided in the template, it will be resolved to its value and any changes to the bound property cause the helper function to be re-run with the updated values.

  • params - An array of resolved ordered parameters.
  • hash - An object containing the hash parameters.

For example:

  • With an unquoted ordered parameter:
  {{x-capitalize foo}}

Assuming foo was set to "bar", the bound helper would receive ["bar"] as its first argument, and an empty hash as its second.

  • With a quoted ordered parameter:
  {{x-capitalize "foo"}}

The bound helper would receive ["foo"] as its first argument, and an empty hash as its second.

  • With an unquoted hash parameter:
  {{x-repeat "foo" count=repeatCount}}

Assuming that repeatCount resolved to 2, the bound helper would receive ["foo"] as its first argument, and { count: 2 } as its second.

Parameters:

fn Function

© 2017 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://emberjs.com/api/classes/Ember.HTMLBars.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部