Class Errors
publicHolds validation errors for a given record, organized by attribute names.
This class is not directly instantiable.
Every Model
has an errors
property that is an instance of
Errors
. This can be used to display validation error
messages returned from the server when a record.save()
rejects.
For Example, if you had a User
model that looked like this:
```js {data-filename=app/models/user.js} import Model, { attr } from '@ember-data/model';
export default class UserModel extends Model {
isEmpty public
Defined in ../packages/model/src/-private/errors.ts:205
true
if we have no errors.
length public
Defined in ../packages/model/src/-private/errors.ts:196
Total number of errors.
messages public
Defined in ../packages/model/src/-private/errors.ts:155
An array containing all of the error messages for this record. This is useful for displaying all errors to the user.
{{#each @model.errors.messages as |message|}}
<div class="error">
{{message}}
</div>
{{/each}}