Giter Site home page Giter Site logo

suniltaneja / angular-initial-value Goto Github PK

View Code? Open in Web Editor NEW

This project forked from glaucocustodio/angular-initial-value

0.0 1.0 0.0 180 KB

A tiny AngularJS directive to set ng-model (and consequently field value) based on form fields attributes.

License: MIT License

JavaScript 51.33% HTML 48.67%

angular-initial-value's Introduction

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:

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
<script src="//cdn.jsdelivr.net/angular.initial-value/latest/angular-initial-value.min.js"></script>

2- Load the module in your application:

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, color, range, search, url, password, checkbox, radio, select, textarea.

<body ng-app="myApp">
  <input type="text" value="John" name="text" initial-value ng-model="text" id="text"/>
</body>

You can pass the start value to attribute as well (this feature is not available only for checkbox and radio)

<body ng-app="myApp">
  <input type="text" name="text" initial-value="John" ng-model="text" id="text"/>
</body>

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 for more information.

Related projects

After starting this project I found this another one which pretends deal with the same issue.

License

This projected is licensed under the terms of the MIT license.

angular-initial-value's People

Contributors

glaucocustodio avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.