I am trying to bind "oninput" event of input range element to a custom method declared in respective typescript file.
Following is the HTML element:
<input type="range" id='motivation-grade' value="3" min="1" max="5">
This is the event listener code which I am using in ngOnInit method of my angular2 component:
ngOnInit() {
this.elem = document.getElementById('motivation-grade');
this.elem.addEventListener("click", this.motivation(document.getElementById('motivation-grade').value));
}
Here in motivation(str:string) method, I want to show some links based on selected value every time user changes it. But motivation() method is firing only once in starting and after that it is not seemed to be hit. Can somebody help me to understand what I am missing?