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 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-input-types

v2.0.3

Published

AngularJS directives used on form inputs. Makes it easy for the users to input the correct information using autocomplete and validation.

Downloads

10

Readme

Angular Input Types

npm version Build Status Dependency Status peerDependency Status devDependency Status

Angular Input Types is used to create form inputs which help users enter the correct format using autocomplete and validation. See available input types below.

Demo

There is a demo at https://www.blitter.se/angular-input-types/examples/

Installation

Several options are available:

Usage

Include angular-input-types.min.js on the page.

<script src="angular-input-types.min.js"></script>

Include the inputTypes dependency in on your AngularJS module.

var app = angular.module('exampleApp', [ 'inputTypes' ]);

See how to use different input types below.

Swedish SSN (i.e. personnummer)

Helps the user to enter a swedish SSN in the format of yyyymmdd-nnnn.

The input must have an ng-model for the validation to work.

<input type="tel" id="personnummer" ng-model="personnummer" input-personnummer/>

Swedish organization number

Helps the user to enter an swedish organization number in the format of nnnnnn-nnnn or nnnnnnnn-nnnn. Also allows Swedish SSN as that could be an organization number.

The input must have an ng-model for the validation to work.

<input type="tel" id="orgnr" ng-model="orgnr" input-orgnr/>

Number

Helps the user to enter a number by adding thousand separators and restricting number of decimals.

The input must have an ng-model for the validation to work. The type has to be tel to work in Firefox on Android.

<input type="tel" id="number" ng-model="number" input-number/>

The thousand separator and decimal separators comes from $locale. You can override these like this.

angular.module('myApp').run(['$locale', function($locale) {
  $locale.NUMBER_FORMATS.GROUP_SEP = ' '; // Use space as thousand separator
  $locale.NUMBER_FORMATS.DECIMAL_SEP = ','; // Use comma as decimal separator
}])

Change number of decimals for all input-number fields. Default is no decimals.

angular.module('myApp').config(['inputNumberProvider', function(inputNumberProvider) {
    inputNumberProvider.nrOfDecimals = 2;
}]);

Change number of decimals for a single field.

<input type="tel" id="number" ng-model="number" input-number decimals="2"/>

Set a minimum allowed value.

<!-- This example only allows positive values -->
<input type="tel" id="number" ng-model="number" input-number min="0"/>

Time

Helps the user to enter a time using native time input on mobile devices by setting type="time" on the input element. The input-time attribute adds validation plus autocomplete as fallback.

The input must have an ng-model for the validation to work.

<input type="time" id="time" ng-model="time" input-time/>

input-time on Android