Skip to content

Validation Error Format #82

Open
Open
@jerradpatch

Description

@jerradpatch

I am wanting to bind the validation error to my template with NG4, however given the current output of ValidationError[] I have to iterate to find the offender and then pull the message. I then have to bind the message to an object that is bound to the error for that field. I would be nice to get an object output instead of an array that could be bound to.

validationErrors: {
   <fieldName>: [{constraint: <constraintName>, message: <actualMessage>}],
   <anotherFieldName: [{...},{...}],
    ...
}
Where in the template I could bind to this result with angular4
<div *ngFor="let err of resultModel.email">
    {{err.constraint}}{{err.email}}
</div>
<input type="email" [(ngModel)]="model.email">

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions