File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed
samples/angular/MusicStore
wwwroot/ng-app/components/admin Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ public async Task<ActionResult> CreateAlbum([FromBody]AlbumChangeDto album)
9898 if ( ! ModelState . IsValid )
9999 {
100100 // Return the model errors
101- return new ValidationErrorResult ( ModelState ) ;
101+ return HttpBadRequest ( ModelState ) ;
102102 }
103103
104104 // Save the changes to the DB
Original file line number Diff line number Diff line change @@ -89,8 +89,8 @@ export class AlbumEdit {
8989 } ) ;
9090 }
9191
92- public get formErrors ( ) {
93- return Object . keys ( this . form . errors || { } ) ;
92+ public get formErrors ( ) : string [ ] {
93+ return this . form . dirty ? Object . keys ( this . form . errors || { } ) : [ ] ;
9494 }
9595}
9696
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ export class FormField {
1212 private validate : ng . AbstractControl ;
1313
1414 public get errorMessages ( ) {
15- var errors = ( this . validate && this . validate . touched && this . validate . errors ) || { } ;
15+ var errors = ( this . validate && this . validate . dirty && this . validate . errors ) || { } ;
1616 return Object . keys ( errors ) . map ( key => {
1717 return 'Error: ' + key ;
1818 } ) ;
You can’t perform that action at this time.
0 commit comments