bug: ion-range event value is always type RangeValue {lower, upper}.
See original GitHub issueBug Report
Ionic version: [x] 4.x
Current behavior:
The type of the ion-range
value is always RangeValue
({ lower: number; upper: number; }
).
Type 'RangeValue' is not assignable to type 'number'.
Type '{ lower: number; upper: number; }' is not assignable to type 'number'.ts(2322)
Expected behavior:
But by the docs it should be number
OR RangeValue
(number | { lower: number; upper: number; }
)
Steps to reproduce:
Create a ion-range
and append ionChange
event. Please see related code…
Related code:
html
<ion-range
(ionChange)="onRangeChange($event)"
[min]="min"
[max]="max"
debounce="500"
></ion-range>
ts (error visible, see Current behavior section.)
onRangeChange(event: IonRange) {
this.value = event.value;
}
Other information: Workaround: Cast to number. But maybe it’s unsafe.
I think it’s just a type definition issue.
Ionic info:
Ionic CLI : 5.2.8
Ionic Angular : 4.9.1
NodeJS : v10.15.3
npm : 6.4.1
OS : Windows 10
VSCode : 1.38.1
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
A Sliding Nightmare: Understanding the Range Input
The padding area is always transparent, while the border area and content-box are semitransparent (orange for the actual input , red for the ......
Read more ><input type="range"> - HTML: HyperText Markup Language
elements of type range let the user specify a numeric value which must be no less than a given value, and no more...
Read more >HTML5 input type range show range value - Stack Overflow
Show activity on this post. Note that this type of HTML input element has one hidden feature, such as you can move the...
Read more >HTML input type="range" - W3Schools
The <input type="range"> defines a control for entering a number whose exact value is not important (like a slider control). Default range is...
Read more >onChange event doesn't trigger when direclty clicking on the ...
When you directly after the loading choose the maximum value on the input type range, the event isn't fire with an onChange.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can confirm this is still present in the latest @ionic/angular version (5.0.7)
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.