angular-reset-on

Resets a field to its initial value (or cleans) when given scope expression is true.

Download .zip Download .tar.gz View on GitHub

ng-reset-on directive

Resets a field to its initial value (or cleans) when given scope expression is true.

Build Status Dependency Status Coverage Status Open Issues License

Demo

Just visit https://waldirpereira.github.io/angular-reset-on/example!

Installation

Install with Bower

$ bower install angular-reset-on

Install with NPM

$ npm install angular-reset-on

Manual download

Just import the angular-reset-on.js file on dist directory to your project.

Usage

You must include the module as a dependency of yours, something like:

.js

angular.module('myModule', ['ng-reset-on'])

.html

<body ng-app="myModule">
    <div ng-controller="Ctrl">
        <input type="text" ng-model="thisField" ng-reset-on="anotherField === 1" mode="reset" />
    </div>
</body>

Options

  • ng-reset-on: AngularJS expression (required)
  • mode: (default: clean)
    • reset: resets the field to its initial value
    • clean: cleans the field

Changelog

See CHANGELOG.md

Contribution

  • Using Gulp as build tool
  • Uses jasmine 2.5.2 in writing unit test specs
  • gulp to build the project
  • gulp test to run unit tests
  • Update README.md and CHANGELOG.md to reflect the new changes
  • Update the version number of package.json and bower.json