ember.js - `keyUp` not working, what is the correct way to trigger a keyup on input field -


i trying integrate keyup event in input element. not works @ all. 1 me showing correct way trigger event?

here hbs file:

<span class="opt-num">             <input type="number" tabindex="1" min="0" max="9" maxlength="1" value="" onkeyup={{action "numbervalidate"}} style="border:1px solid red" >          </span> 

my route.js file :

actions:{          numbervalidate(){ console.log("hi") } } 

but getting error : failed: action named 'numbervalidate' not found

template hbs context controller, need define numbervalidate function in actions hash of controller.

if want call router action, have 2 options,
1. bubble controller define functions controller , there need call functions in route. in route.js file,

actions:{  numbervalidateinroute(){ console.log("hi") } } 

in controller.js file, need bubble using send method.

actions:{  numbervalidate(){     this.send('numbervalidateinroute');  } } 
  1. use ember-route-action helper addon.

checkout my detailed answer lot more articles related topic.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -