Giter Club home page Giter Club logo

deft-angular-format's Introduction

Deft-Angular-Format Build Statuscodecov.io

Deft-Angular-Format is a small angular module that allows you to easily format your input e.g. zipCode in a general way

Installing Deft-Angular-Format

  • Clone the repo: git clone https://github.com/deft/deft-angular-format.git
<script src="/path/to/your/scripts/here/dist/deft-format.min.js"></script>
  • Install with Bower: bower install deft-angular-format
<script src="/bower_components/deft-angular-format/dist/deft-format.min.js"></script>

Using Deft-Angular-Format

  • Add a dependency to deft.format in your app module, eg: angular.module('myModule', ['deft.format'])
  • Format an input like:
<div>
	<input ng-model="zipCode" deft-format="4D 2S" />
</div>

Documentation

The formatter will execute immediately for ng-model parser, however, will wait till blur to update the input.

There are currently 3 types of data you can give in your format string:

  • Quantifier
  • Command
  • Extra content

Quantifier

A quantifier is nothing more than an whole, positive, number you add to your string. Directly after it should de command be found.
A quantifier is to specify how much times you want to use the following command, e.g. how many digits you want formatted.

Command

The following command can be a D or a S. With the D you specify to format digits and with the S currently the rest, spaces excluded.

Extra content

Extra content is everything else. You can escape Quantifiers by adding a slash. This is not nescessary when no command is followed.
Adding slashes on it's own is currently not featured.

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.