Git Product home page Git Product logo

angular-input-masks's Introduction

angular-input-masks Build Status Coverage Status

Join the chat at https://gitter.im/assisrafael/angular-input-masks Bountysource

Personalized and localized input masks for AngularJS

Installation

With Bower:

bower install --save angular-input-masks

How to use

  1. Import the masks.min.js script in your page.

  2. Include the module ui.utils.masks in your angular app.

  3. Include the ui-mask directive in a text field like the examples abouve:

ui-number-mask

  • Example:
<input type="text" name="field" ng-model="number" ui-number-mask>
  • Define the number of decimals (default is 2):
<input type="text" name="field" ng-model="number" ui-number-mask="3">
  • Allow negative numbers using the ui-negative-number attribute:
<input type="text" name="field" ng-model="number" ui-number-mask="4" ui-negative-number>
  • Support to the min, max and ui-hide-group-sep attributes.
<input type="text" name="field" ng-model="number" ui-number-mask min="10.1" max="100.9">
<!-- Use 'ui-hide-group-sep' attribute if you don't want show the thousands separators-->
<input type="text" name="field" ng-model="number" ui-number-mask ui-hide-group-sep>
  • Internationalized: Used the decimal separator and the thousands separator defined in the client browser configuration.

ui-percentage-mask

  • Example:
<input type="text" name="field" ng-model="percentage" ui-percentage-mask>
  • You can set the number of decimals (default is 2):
<input type="text" name="field" ng-model="percentage" ui-percentage-mask="4">
  • Support to the min, max and ui-hide-group-sep attributes.

  • Internationalized: Used the decimal separator and thousands separator defined in the client browser configuration.

  • The $modelValue is the $viewValue / 100, so $viewValue - 100% = $modelValue - 1

ui-money-mask

  • Example:
<input type="text" name="field" ng-model="money" ui-money-mask>
  • Define the number of decimals (default is 2):
<input type="text" name="field" ng-model="money" ui-money-mask="3">
  • Support to the min, max and ui-hide-group-sep attributes.

  • Internationalized: Used the currency symbol, decimal separator and thousands separator defined in the client browser configuration.

ui-br-phone-number

<input type="text" name="field" ng-model="phoneNumber" ui-br-phone-number>

ui-br-cep-mask

<input type="text" name="field" ng-model="cep" ui-br-cep-mask>

ui-br-cpf-mask

  • Example:
<input type="text" name="field" ng-model="initializedCpf" ui-br-cpf-mask>

ui-br-cnpj-mask

  • Example:
<input type="text" name="field" ng-model="initializedCnpj" ui-br-cnpj-mask>

ui-br-cpfcnpj-mask

  • Example:
<input type="text" name="field" ng-model="initializedCpfCnpj1" ui-br-cpfcnpj-mask>

ui-br-ie-mask

<select ng-init="ufs=['AC','AL','AM','TO']" ng-model="selectedUF" ng-options="uf for uf in ufs"></select>
<input type="text" name="field19" ng-model="ieField" ui-br-ie-mask='selectedUF'>

More examples

See more usage examples in the Demo page

Filters

Looking for related filters? Take a look at angular-br-filters

Build

npm install
gulp build

Tests

gulp test:unit
  • e2e:
  • Uses Protractor + Jasmine
  • Files: src/**/*.test.js
gulp test:e2e
  • To run both tests:
gulp test

angular-input-masks's People

Contributors

assisrafael avatar the-darc avatar svemir avatar dvbeato avatar scardine avatar gitter-badger avatar wfgomes avatar marcelinhov2 avatar

Watchers

James Cloos avatar Victor Martins 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.