Skip to content

fix(angular): min/max validator for ion-input type number - #27993

Merged
sean-perkins merged 7 commits into
mainfrom
sp/FW-380
Aug 18, 2023
Merged

sean-perkins merged 7 commits into
mainfrom
sp/FW-380

Conversation

@sean-perkins

@sean-perkins sean-perkins commented Aug 14, 2023 •

Copy link
Copy Markdown
Contributor

Issue number: Resolves #23480


What is the current behavior?

Angular's min/max validators do not work with ion-input[type=number]. Using the built-in validators with ion-input will not update the control status to invalid, reflect the ng-invalid class or report the correct errors.

What is the new behavior?

  • The IonicModule now includes two additional directive declarations that extend Angular's built-in min/max validators and target the ion-input component when using type="number".

Does this introduce a breaking change?

  • Yes
  • No

Other information

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions Bot added the package: angular @ionic/angular package label Aug 14, 2023
@sean-perkins
sean-perkins marked this pull request as ready for review August 15, 2023 15:37
@sean-perkins
sean-perkins requested review from a team and brandyscarney and removed request for a team August 15, 2023 15:40

@brandyscarney brandyscarney left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! Optional: do we want to add a test for it being valid?

@sean-perkins

Copy link
Copy Markdown
Contributor Author

The controls are initially valid when the test form page renders, so I can absolutely update the existing tests to check if the control is valid before modifying the input to an invalid state 👍

@brandyscarney

Copy link
Copy Markdown
Member

That was fast! Haha looks good once it passes. 👍

@sean-perkins
sean-perkins added this pull request to the merge queue Aug 18, 2023
Merged via the queue into main with commit 77707b8 Aug 18, 2023
@sean-perkins
sean-perkins deleted the sp/FW-380 branch August 18, 2023 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: angular @ionic/angular package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Angular min/max validation not working on ion-input

2 participants