Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/wurde/model-errors
- Owner: wurde
- License: mit
- Created: 2017-12-12T16:36:20.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-09T02:37:21.000Z (almost 7 years ago)
- Last Synced: 2024-04-24T15:43:01.886Z (7 months ago)
- Language: JavaScript
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
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).