Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wurde/model-errors

Add errors to a model.
https://github.com/wurde/model-errors

Last synced: 5 days ago
JSON representation

Add errors to a model.

Awesome Lists containing this project

README

        

# model-errors

Add errors to a model.

## Getting started

```bash
npm install model-errors --save
```

```javascript
const ModelErrors = require('model-errors')

class Post {
constructor(param) {
this.errors = new ModelErrors()
}
}
```

```html
<% if (post.errors.exists) { %>




The form contains <%= post.errors.count %> errors.


    <% for (let i=0; i < post.errors.count; i++) { %>

  • <%= post.errors.messages[i] %>

  • <% } %>




<% } %>
```

## Changelog

Get the project's history in [CHANGELOG.md](CHANGELOG.md).

## Maintainer

Andy Bettisworth https://andybettisworth.com

## License

This project is released under the [MIT License](LICENSE.txt).