Yes, this will be a noob question, because I'm a complete noob in Angular 2.
I'm trying to pass the value of a range to my component, I already figured out how. But now, I think that would be nice to see the value during the change and not while the change is made. I hope you understand what I'm trying to explain.
in app.component.html
<form action="#">
<input type="text" placeholder="Time"><br>
ram: {{ selectedRam }}
<input #ramSelector name="ram" type="range" min="0" max="{{ ramMaxValue }}" (change)="setRam(ramSelector.value)" value="0">
</form>
in app.component.ts
setRam(value){
this.selectedRam = value;
console.log(this.selectedRam);
}
I found there is this "oninput" method, but didn't work.
Thansk in advance!
Using input
seems to work for me
<input type="range" min="0" max="100" #ranger (input)="yourMethod(ranger.value)">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With