npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

angular-fcsa-number

v1.5.7

Published

An Angular directive that validates numbers and adds commas for the thousands separator.

Readme

FCSA Number

An Angular directive that validates numbers and adds commas for the thousands separator.

So when the user enters 1000 into a textbox and tabs out, the value will be formatted to include the thousands separator and display: 1,000

If an invalid number is entered, the textbox will be invalid with the fcsaNumber error.

Installation

With Bower

bower install angular-fcsa-number

With Npm

npm install angular-fcsa-number

Then reference angular-fcsa-number/src/fcsaNumber.js in your project.

Manually

Copy src/fcsaNumber.js into your project and reference it.

Quick Start

Add the fcsa-number module as a dependency to you Angular app.

angular.module('yourApp', ['fcsa-number']);

Add the fcsa-number attribute to textboxes you want to have validated and formatted with thousands separators.

<input type='text' ng-model='company.employeeCount' fcsa-number />

When an invalid number is entered by the user, the form and control will become invalid and the 'fcsa-number-invalid' class will be added to the text box.

Options

Without any options passed to it, fcsa-number will validate that the input is a valid number and will also add commas for the thousand separators.

max

Validates the number is not above the max number.

fcsa-number="{ max: 100 }"
  • Valid: 100
  • Invalid: 101

min

Validates the number is not below the min number.

fcsa-number="{ min: -5 }"
  • Valid: -5
  • Invalid: -6

maxDecimals

Validates the number does not have more than the specified number of decimals.

fcsa-number="{ maxDecimals: 2 }"
  • Valid: 1.23
  • Invalid: 1.234

maxDigits

Validates the number does not have more than the specified number of digits.

fcsa-number="{ maxDigits: 2 }"
  • Valid: 76
  • Invalid: 123

preventInvalidInput

By default users are allowed to enter invalid characters, and then the textbox is marked invalid. If you want to prevent users from entering invalid characters altogether, then use the preventInvalidInput option. If the user presses the 'a' key, the directive will catch it and prevent 'a' from being shown in the textbox.

fcsa-number="{ preventInvalidInput: true }"

prepend

Prepends the specified text before the number.

fcsa-number="{ prepend: '$' }"

append

Appends the specified text after the number.

fcsa-number="{ append: '%' }"

formatOnly

Turns off any validation. Only format engine should work

fcsa-number="{ formatOnly: true }"

Default Options

It's possible to set the options globally too. You do this by calling fcsaNumberConfigProvider.setDefaultOptions() inside a config function in your app.

Here's a code example that sets the default options:

var app = angular.module('yourApp', ['fcsa-number']);
app.config(['fcsaNumberConfigProvider', function(fcsaNumberConfigProvider) {
  fcsaNumberConfigProvider.setDefaultOptions({
    max: 100,
    min: 0
  });
});

The default options can be overridden locally by passing in an options object: fcsa-number="{ max: 10 }"

Developing

Grunt is used to compile the CoffeeScript files and run the tests. To get started run the following commands on the command line:

// installs the required node modules
npm install

// installs the required bower components
bower install

Run the following command to automatically compile and run the unit and end to end tests whenever you make a change to a file.

grunt karma:unit:start express:dev watch

To just run the protractor tests, you can run the following command.

grunt express:dev e2e