Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Floating label on ion-datetime always floats if it's in a formGroup or has ngModel #11547

Closed
imgx64 opened this issue May 8, 2017 · 2 comments · Fixed by #11552
Closed

Floating label on ion-datetime always floats if it's in a formGroup or has ngModel #11547

imgx64 opened this issue May 8, 2017 · 2 comments · Fixed by #11552

Comments

@imgx64
Copy link
Contributor

imgx64 commented May 8, 2017

Ionic version: (check one with "x")
[x] 3.x

I'm submitting a ... (check one with "x")
[x] bug report

Current behavior:
A floating label on <ion-datetime> always floats above the input, even if no date is selected. This happens if the ion-datetime has ngModel or is in a formGroup. If it's neither, then it only floats when a date is selected (but then it becomes useless, as you can't actually get the value).

screenshot

Expected behavior:
The floating label should only float when a date is selected.

Steps to reproduce:
See this plunker

Related code:
Other information:
I think the issue is in the hasValue() method in base-input.ts. It returns true if the datetime has the "empty" date (which is just {}). Either ion-datetime should have null or undefined value until a date is selected, or it could override hasValue() and return false if the value is {}.

Ionic info:

> ionic info

Your system information:

 ordova CLI: 7.0.0
Ionic Framework Version: 3.1.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.6
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.3
Xcode version: Not installed```

@gandrade74
Copy link

Same problem here.

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 3, 2018

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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants