Skip to content

Commit e9ba747

Browse files
Fixes
1 parent 8a148d8 commit e9ba747

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

samples/angular/MusicStore/Apis/AlbumsApiController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

samples/angular/MusicStore/wwwroot/ng-app/components/admin/album-edit/album-edit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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

samples/angular/MusicStore/wwwroot/ng-app/components/admin/form-field/form-field.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
});

0 commit comments

Comments
 (0)