This commit is contained in:
SteveSandersonMS
2015-12-14 12:43:56 +00:00
parent 8a148d8535
commit e9ba74761d
3 changed files with 4 additions and 4 deletions

View File

@@ -98,7 +98,7 @@ namespace MusicStore.Apis
if (!ModelState.IsValid)
{
// Return the model errors
return new ValidationErrorResult(ModelState);
return HttpBadRequest(ModelState);
}
// Save the changes to the DB

View File

@@ -89,8 +89,8 @@ export class AlbumEdit {
});
}
public get formErrors() {
return Object.keys(this.form.errors || {});
public get formErrors(): string[] {
return this.form.dirty ? Object.keys(this.form.errors || {}) : [];
}
}

View File

@@ -12,7 +12,7 @@ export class FormField {
private validate: ng.AbstractControl;
public get errorMessages() {
var errors = (this.validate && this.validate.touched && this.validate.errors) || {};
var errors = (this.validate && this.validate.dirty && this.validate.errors) || {};
return Object.keys(errors).map(key => {
return 'Error: ' + key;
});