I am attempting to connect the "oninput" event of an input range element to a custom method defined in a corresponding typescript file.
Here is the HTML element:
<input type="range" id='motivation-grade' value="3" min="1" max="5">
This is the code for the event listener that I am using in the ngOnInit function of my Angular 2 component:
ngOnInit() {
this.elem = document.getElementById('motivation-grade');
this.elem.addEventListener("click", this.motivation(document.getElementById('motivation-grade').value));
}
In the motivation(str:string) method, I intend to display some links based on the selected value whenever the user changes it. However, the motivation() method only executes once at the beginning and then does not appear to be triggered again. Could someone assist me in understanding what I might be overlooking?