ion-select always returns string even when value is a number..
See original GitHub issueIonic version: (check one with “x”) [ ] 1.x (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1) [ ] 2.x [x] 3.x
I’m submitting a … (check one with “x”) [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
I have a select with an object containing an id and a name. The id is a number and the name is a string. The option value is the id and the display value the name. Setting the select model to an existing id which is a number works and the correct preselected name is displayed. However, chosing a different option rwill return the id of the newly select object but not as a number. Instead it will be a string. I manually need to convert it back…
Expected behavior:
The selected value (id) should be returned as a number when it is a number.
Steps to reproduce:
Create select with multiple options being a number. Select a different option will return it as a string…
Related code:
insert any relevant code here
Other information:
Ionic info: (run ionic info
from a terminal/cmd prompt and paste output below):
global packages:
@ionic/cli-plugin-proxy : 1.3.1
@ionic/cli-utils : 1.4.0
Cordova CLI : 6.5.0
Ionic CLI : 3.4.0
local packages:
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms : android 5.2.1 browser 4.1.0 ios 4.2.0 windows 4.4.3
Ionic Framework : ionic-angular 3.2.1
System:
Node : v6.10.0
OS : Windows 10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 4.6.1
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
You probably should bind as
[value]
and notvalue
if that is what you are doing.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.