See input range value as it changes with Angular 2

On angular 5:

<input type="range" min="0" [attr.max]="myMax" [value]="myValue" (input)="doSomething()">

Works for me!!

(Not enough reputation to comment that it still works on angular 5)


Using input seems to work for me

<input type="range" min="0" max="100" #ranger (input)="yourMethod(ranger.value)">

You can simply use the input event like so:

<label for="time">Time ({{ time.value }})</label>
<input type="range" #time (input)="time.value" id="time" min="0" max="100">

This will show you the range value as you change it.


try using ng model like below :

<form action="#">
<input type="text" placeholder="Time"><br>
ram: {{ selectedRam }}
<input #ramSelector name="ram" type="range" min="0" max="{{ ramMaxValue }}" [(ngModel)]="mymodel" (ngModelChange)="setRam($event)" value="0">

Tags:

Angular