Inputmask icon indicating copy to clipboard operation
Inputmask copied to clipboard

How to implement this plugin with angular 7. Please mention the steps to follow.

Open rakeshnayak360 opened this issue 5 years ago • 6 comments

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

rakeshnayak360 avatar Apr 12 '19 13:04 rakeshnayak360

I created a stackblitz that uses Inputmask as a directive for Angular inputs. It's intended to demo a specific bug, but you should be able to see how I have Inputmask working with Angular.

Originally, I was using the import import * as Inputmask from 'inputmask'; but this was causing the stackblitz to fail, and the workaround I found is import Inputmask from 'inputmask' so if you have any issues with importing the library try the second import statement.

GershonR avatar Jul 17 '19 20:07 GershonR

and how to register extensions?

Franky238 avatar Nov 05 '19 23:11 Franky238

Here is a bit more comprehensive of a solution with Angular 10 using ControlValueAccessor. The main benefit is a validator for the mask. It also handles a case where ? means optional character for AngularJS UI mask which is based on Herbots mask:

https://stackblitz.com/edit/angular-10-herbots-jquery-inputmask?file=src%2Fapp%2Fdirectives%2Fui-mask.directive.ts

jamesnben avatar Dec 22 '20 16:12 jamesnben

@jamesnben Thank you. Almost working I'm having trouble with dynamic placeholder. On blur it changing value that was set on init. <input matInput type="tel" [uiMask]="'numeric'" [uiMaskOptions]="{rightAlign: false, placeholder: '', showMaskOnHover: false, showMaskOnFocus: false, allowPlus: false, allowMinus: false }" [required]="f.value.required" [(ngModel)]="form[f.key]" [placeholder]="generatePlaceholder(f)" > Any idea how to fix that? Thank you!

maxkopych avatar Apr 24 '21 21:04 maxkopych

Use this: https://github.com/ngneat/input-mask

KingDarBoja avatar May 28 '21 15:05 KingDarBoja

@maxkopych I realize it took a while to respond here, but I would need a stackblitz of the problem you are encountering to help. I would only recommend only using the mask wrapper I created for Angular 2+ if you really need to keep the formatting of this particular mask. For example, if you are upgrading from AngularJS UI mask.

jamesnben avatar Nov 04 '21 15:11 jamesnben