All Projects → rafaelcorradini → ngx-ion-simple-mask

rafaelcorradini / ngx-ion-simple-mask

Licence: MIT, Unknown licenses found Licenses found MIT LICENSE Unknown license-banner.txt
Input mask for Angular/Ionic

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to ngx-ion-simple-mask

ionic4-angular7-httpinterceptor-example
Ionic 4 and Angular 7 Tutorial: HTTP Interceptor Example
Stars: ✭ 15 (-28.57%)
Mutual labels:  ionic, ionic4, angular7
ionic4-angular7-example
Ionic 4, Angular 7 and Cordova Tutorial: Build CRUD Mobile Apps
Stars: ✭ 57 (+171.43%)
Mutual labels:  ionic, ionic4, angular7
ionic4-image-crop-upload
Ionic 4, Angular 7 and Cordova Crop and Upload Image
Stars: ✭ 16 (-23.81%)
Mutual labels:  ionic, ionic4, angular7
ionic-modal-custom-transitions
Add Custom Transitions to Ionic Modals.
Stars: ✭ 22 (+4.76%)
Mutual labels:  ionic, ionic-angular, ionic4
angular-progress-bar
This component allow you to easy incorporate progress-bar to angular/ionic project, providing binding and color options
Stars: ✭ 26 (+23.81%)
Mutual labels:  ionic, ionic4, angular7
ionic4-angular8-crud-mobileapps-example
Ionic 4 Angular 8 Tutorial: Learn to Build CRUD Mobile Apps
Stars: ✭ 20 (-4.76%)
Mutual labels:  ionic, ionic4
ionic-facebook-login
Ionic starter app to show you how to add Facebook Log In to an Ionic App.
Stars: ✭ 69 (+228.57%)
Mutual labels:  ionic, ionic-angular
ionic4-ngrx-firebase
A basic application for Ionic 4 with firebase & ngrx actions, reducers and effects
Stars: ✭ 17 (-19.05%)
Mutual labels:  ionic, ionic4
example-cordova-code-push-plugin
Ionic + Cordova Code Push Plugin Example
Stars: ✭ 45 (+114.29%)
Mutual labels:  ionic, ionic4
ionic-truncated-slider-cards
Customized slider component to achieve a fancy horizontal truncated slider, basically for short list of cards
Stars: ✭ 19 (-9.52%)
Mutual labels:  ionic, ionic4
ionic-audio-player
A simple audio player created with Ionic 4+ / Angular 8+ (updated in Aug 2019)
Stars: ✭ 72 (+242.86%)
Mutual labels:  ionic, ionic4
ionic4-boilerplate
🚀 boilerplate for ionic4 with CI based on travis and fastlane. doc and example are provided
Stars: ✭ 25 (+19.05%)
Mutual labels:  ionic, ionic4
ionic-signature-pad
Ionic plugin to input singnature pad
Stars: ✭ 15 (-28.57%)
Mutual labels:  ionic, ionic4
ngx-ionic-image-viewer
An Ionic 4 Angular component to view & zoom on images and photos without any additional dependencies.
Stars: ✭ 129 (+514.29%)
Mutual labels:  ionic, ionic4
angular-code-input
Code (number/chars/otp/password) input component for angular 7, 8, 9, 10, 11, 12+ projects including Ionic 4, 5 +
Stars: ✭ 112 (+433.33%)
Mutual labels:  ionic, angular7
app-starter
Angular mono-repo (Ionic/Capacitor/StencilJS/Web Component) app starter for supporting cross platform apps.
Stars: ✭ 75 (+257.14%)
Mutual labels:  ionic, ionic4
ionic-uber-clone
Ionic 4 Taxi Booking script
Stars: ✭ 34 (+61.9%)
Mutual labels:  ionic, ionic4
Ngx Mask
Angular Plugin to make masks on form fields and html elements.
Stars: ✭ 772 (+3576.19%)
Mutual labels:  ngx, mask
Starter Kit
📦 Angular 11+ starter kit for enterprise-grade projects
Stars: ✭ 1,102 (+5147.62%)
Mutual labels:  ionic, ngx
Ng Zorro Antd Mobile
A configurable Mobile UI components based on Ant Design Mobile and Angular. 🐜
Stars: ✭ 709 (+3276.19%)
Mutual labels:  ionic, ngx

GitHub license Build Status

ngx-ion-simple-Mask

Input mask for Angular/Ionic (Tested with Ionic 4)

Installing

$ npm install --save ngx-ion-simple-mask

Usage

Import ngx-ion-simple-mask module in Angular app.

import { SimpleMaskModule } from 'ngx-ion-simple-mask'

@NgModule({
  imports: [
    SimpleMaskModule
  ]
})

Or import the directive/pipe separately

import { SimpleMaskDirective, SimpleMaskPipe } from 'ngx-ion-simple-mask'

@NgModule({
  declarations: [
    SimpleMaskDirective,
    SimpleMaskPipe
  ]
})

Ionic

ionic usage example:

<ion-input simpleMask="999.999.999-99" [clearIfNotMatch]="true"></ion-input>

Angular

Angular usage example:

<input simpleMask="999.999.999-99" [clearIfNotMatch]="true">

Form Control/NgModel

The libray works with Form Control and ngModel:

<input simpleMask="999.999.999-99" [formControl]="formControl">
<input simpleMask="999.999.999-99" [(ngModel)]="value">

Pipe

example

<p>{{ '123321123-12' | simpleMask:'999.999.999-99' }}<p>

output:

<p>123.321.123-12</p>

example with add patterns

<p>{{ 'asd-123' | simpleMask:'aaa-II':{'I': '[0-9]' } }}<p>

output:

<p>asd-12</p>

example with new patterns(ignoring old patterns)

<p>{{ '123-bddd' | simpleMask:'III-aaa':{'I': '[0-9]' }:true }}<p>

output:

<p>123-aaa</p>

Patterns

Default patterns:

patterns = {
    '9': new RegExp('[0-9]'),
    'a': new RegExp('[a-z]'),
    'A': new RegExp('[A-Z]'),
    'x': new RegExp('[a-zA-Z]'),
    '*': new RegExp('[a-zA-Z0-9]'),
    '~': new RegExp('[-\+]')
};
pattern meaning
9 digits (0-9)
a lowercase letters (a-z)
A uppercase letters (A-Z)
x letters uppercase or lowercase (a-z, A-Z)
~ - or +
* letters or digits (a-z, A-Z, 0-9)
\ cancel next pattern effect

Examples

mask example
999.999.aaa 113.123.asd
(AA) 999 (AS) 123
999\~ 999~

Set new patterns

The set strings will be used as regex

<input
    simpleMask="IIIxxx"
    [newPatterns]="{ 'I': '[a-z]', 'x': '[0-9]' }">

example of input: abc123

Add patterns

The set strings will be used as regex

<input simpleMask="~III999" [addPatterns]="{ 'I': '[a-z]' }">

example of input: +abc123

angular-library-starter

The project was built with angular-library-starter.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].