Feature - Add global error message support#1054
Open
steverhoades wants to merge 2 commits intoudos86:masterfrom
Open
Feature - Add global error message support#1054steverhoades wants to merge 2 commits intoudos86:masterfrom
steverhoades wants to merge 2 commits intoudos86:masterfrom
Conversation
…sage support, add custom error message function support
Codecov Report
@@ Coverage Diff @@
## master #1054 +/- ##
==========================================
- Coverage 90.49% 90.47% -0.02%
==========================================
Files 170 170
Lines 2673 2678 +5
Branches 247 250 +3
==========================================
+ Hits 2419 2423 +4
Misses 196 196
- Partials 58 59 +1
Continue to review full report at Codecov.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds global message support, similar to functionality provided by ngx-formly.
The goals of this PR are as follows.
.
Example Usage:
For the moment some additional "gymnastics" is required in order to get the controls to render the messages. See an example of that below.
//form.component.ts
The model definition still requires that we "opt-in" to error messages.
The result will be a control which shows the "catch-all" error message received from the server.
Room for improvements.
Use Cases:
Given that I am defining multiple forms
When I configure the validation rules
Then I should not have to repeat the errorMessages for each input in order for the messages to display on the control.
Given that I am defining a form
When I configure the validation rules
Then I should be able to process the error via a callback before returning the error message.
Given that I submit a form to the server
When the server returns a 422 response code with validation errors mapped to attribute name
Then show the error contextually on the form.