EmberJS - Helper Arguments



You can pass more than one argument to the helper by specifying after the helper name.

Syntax

export default Ember.Helper.helper(function(params) {
   //code here
}

Example

The example given below passes the multiple arguments to the helper. Create a new helper as helperarguments and add the following code to it −

import Ember from 'ember';

export default Ember.Helper.helper(function(params) {
   let [arg1, arg2] = params;
   document.write("Text is : " +arg1+ ''+arg2);
});

Open the index.hbs file and write the following code −

{{helperarguments "Welcome to" "Tutorialspoint"}}
{{outlet}}

Output

Run the ember server; you will receive the following output −

Ember.js Template Helper Arguments
emberjs_template.htm
Advertisements