ember-error-for
v0.1.0
Published
Renders browser constraint validations messages inline.
Downloads
2
Readme
ember-error-for
Simple wrapper for javascript constraint error messages.
It should satisfy very simple forms.
Compatibility
- Ember.js v3.16 or above
- Ember CLI v2.13 or above
- Node.js v10 or above
Installation
ember install ember-error-for
Usage
It renders a span tag with [hidden]
attribute set.
<form>
<input type="text" name="username" required>
<ErrorFor @name="username" />
<input type="submit">
</form>
Now instead of getting the default browser error message bubble, it will render the error inline.
All possible validations related attributes can be found here.
You can override error messages by passing in one of the ValidityState properties.
e.g.
<form>
<input type="text" name="username" required>
<ErrorFor @name="username"
@valueMissing="Please provider your username" />
<input type="submit">
</form>
Todo
- [ ] Add more tests
Contributing
See the Contributing guide for details.
License
This project is licensed under the MIT License.