
You can modify the action’s first parameter by specifying a value option for the {{action}} helper.
Syntax
<input type = "text" value = {{name}} onblur = {{action "action-name"}} />
Example
The example given below shows modifying the action’s first parameter by using the {{action}} helper with value option. Create a new component and name it as post-action.js with the following code −
import Ember from 'ember'; export default Ember.Component.extend({ actions: { actionFirstParameter(newName) { document.write('Name is:'+' '+newName); } } });
Open the post-action.hbs file created under app/templates/ with the following code −
<label>Enter the name:</label> <input type = "text" value = {{yourName}} onblur = {{action "actionFirstParameter" value = "target.value"}} /> {{outlet}}
Next, open the application.hbs file created under app/templates/ with the following code −
{{post-action}} {{outlet}}
Previous Page:-Click Here