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

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.

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.