I'm working on an Ionic 2 app and playing around with the range, as described here: https://ionicframework.com/docs/v2/api/components/range/Range/
Call me crazy, but I can't find anywhere on google how the range component can call a method in my .ts class once the value has changed.
Something like a button, which goes like this:
<button ion-button (click)="myMethod($event)">
Of course, I need the value of the slider. In my case I defined it as follows:
<ion-range min="0" max="10" color="danger">
<ion-label range-left>0</ion-label>
<ion-label range-right>10</ion-label>
</ion-range>
Anyone got an idea?
SE RWD (Standard Range): MPGe 127 City/ 94 Hwy/110 combined MPGe and 220 mile driving range.
shadow. The Range slider lets users select from a range of values by moving the slider knob. By default one knob controls the value of the range.
The Ionic range slider is used to choose and display the level of values by moving the slider knob. By default, only one knob controls the value of the range, but it can also accept dual knobs.
The answer is right in the docs in the section output-events:
ionChange
Expression to evaluate when the range value changes.
Use it as follows:
<ion-range min="0" max="10" color="danger" (ionChange)="myMethod($event)">
<ion-label range-left>0</ion-label>
<ion-label range-right>10</ion-label>
</ion-range>
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