Angular Input Types
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:
- Download latest version.
- Install with npm:
npm install angular-input-types
- Install with yarn:
yarn add angular-input-types
Usage
Include angular-input-types.min.js on the page.
Include the inputTypes
dependency in on your AngularJS module.
var app = angular;
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.
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.
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.
The thousand separator and decimal separators comes from $locale
. You can override these like this.
angular
Change number of decimals for all input-number
fields. Default is no decimals.
angular;
Change number of decimals for a single field.
Set a minimum allowed value.
<!-- This example only allows positive values -->
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.