EmberJS – Helper Arguments

Argument

You can pass more than one argument to the helper by specifying after the helper’s 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" "Adglob"}}
{{outlet}}

Previous Page:-Click Here

Leave a Reply