https://github.com/glaucocustodio/angular-initial-value
A tiny AngularJS directive to set ng-model (and consequently field value) based on form fields attributes.
https://github.com/glaucocustodio/angular-initial-value
Last synced: 2 months ago
JSON representation
A tiny AngularJS directive to set ng-model (and consequently field value) based on form fields attributes.
- Host: GitHub
- URL: https://github.com/glaucocustodio/angular-initial-value
- Owner: glaucocustodio
- License: mit
- Created: 2014-10-09T19:47:48.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-09-07T12:59:01.000Z (over 8 years ago)
- Last Synced: 2025-01-18T14:07:27.925Z (12 months ago)
- Language: HTML
- Homepage:
- Size: 24.4 KB
- Stars: 25
- Watchers: 7
- Forks: 14
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Angular Initial Value
A tiny AngularJS directive to set ng-model (and consequently field value) based on form fields attributes.
## Usage
1- Download plugin (`bower install angular-initial-value`) or use CDN address and import it after AngularJS:
```html
```
2- Load the module in your application:
```js
var app = angular.module('myApp', ['initialValue']);
```
3- Add `initial-value` attribute for your form fields, it supports the most common inputs like `text`, `email`, `tel`, `number`, `color`, `range`, `search`, `date`, `url`, `password`, `checkbox`, `radio`, `select`, `textarea`.
```html
```
You can pass the start value to attribute as well (this feature is not available only for `checkbox` and `radio`)
```html
```
## How it works
The script will read values from `value`, `checked` and `selected` attributes and load them into its respectives `ng-model`'s.
## Contributing
Check [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
## Related projects
After starting this project I found this another one which intends deal with the same issue.
## License
This projected is licensed under the terms of the MIT license.