EmberJS - Built-in Helpers



Helpers provide extra functionality to the templates and modify the raw value from models and components into proper format for users.

Getting Property Dynamically

You can make use of {{}} helper to send the variable value to another helper or component. It is also helpful for displaying various values based on the computed property result. For instance −

{{get icc part}}

If we take the part as teamrank, then computed property returns the result of this.get('icc.teamrank').

Nesting Built-in Helpers

Helpers can be used to nest one helper within other helper and also with component invocations. The helpers can be nested by using the parentheses () and not by curly braces {{}}. For instance −

{{sum (addition 4 5) 2}}

Here, helper can be used to add 4 and 5 before passing the value to {{sum}}. It will display the result as "11".

emberjs_template.htm
Advertisements