Fixes
This commit is contained in:
parent
8a148d8535
commit
e9ba74761d
|
|
@ -98,7 +98,7 @@ namespace MusicStore.Apis
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
{
|
{
|
||||||
// Return the model errors
|
// Return the model errors
|
||||||
return new ValidationErrorResult(ModelState);
|
return HttpBadRequest(ModelState);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the changes to the DB
|
// Save the changes to the DB
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,8 @@ export class AlbumEdit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public get formErrors() {
|
public get formErrors(): string[] {
|
||||||
return Object.keys(this.form.errors || {});
|
return this.form.dirty ? Object.keys(this.form.errors || {}) : [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ export class FormField {
|
||||||
private validate: ng.AbstractControl;
|
private validate: ng.AbstractControl;
|
||||||
|
|
||||||
public get errorMessages() {
|
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 Object.keys(errors).map(key => {
|
||||||
return 'Error: ' + key;
|
return 'Error: ' + key;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue