Categories
BLOG

pipe mask

The pipe ‘mask’ could not be found #703

Comments

Copy link Quote reply

marocha commented Mar 28, 2020

Hello,
I have this issue and I cant’t make it work anyway. I’ve read a lot of things, but nothing seems to work.
I’m using angular 8.1.3 and ngx-mask 8.1.7 with ionic 5.4.2 and cordova 9.0.0.

I have in my app.module.ts
import < NgxMaskModule, IConfig >from ‘ngx-mask’;
export const options: Partial | (() => Partial) = null;
imports: [
NgxMaskModule.forRoot(options),
. ]

And in my benef.module.ts
import < NgxMaskModule >from ‘ngx-mask’;
@NgModule( <
imports: [
NgxMaskModule.forChild(),
. ]

It’s my first angular 2+ project so I’m a little lost. Any idea how can I solve this?

Hello, I have this issue and I cant't make it work anyway. I've read a lot of things, but nothing seems to work. I'm using angular 8.1.3 and ngx-mask 8.1.7 with ionic 5.4.2 and cordova 9.0.0. I have in my app.module.ts import { NgxMaskMo…

ngx-mask

You can also try our NGX LOADER INDICATOR. You can also try our NGX COPYPASTE.

You can see the full documentation with examples

Import ngx-mask module in Angular app.

With default mask config options

Passing in your own mask config options

Or using a function to get the config:

Then, just define masks in inputs.

Also, you can use mask pipe.

For separator you can add thousandSeparator

mask example
9999-99-99 2017-04-15
0*.00 2017.22
000.000.000-99 048.457.987-98
AAAA 0F6g
SSSS asDF

You can define your custom options for all directives (as object in the mask module) or for each (as attributes for directive). If you override this parameter, you have to provide all the special characters (default one are not included).

We have next default characters:

character
/
(
)
.
:
space
+
,
@
[
]

We have next default patterns:

code meaning
0 digits (like 0 to 9 numbers)
9 digits (like 0 to 9 numbers), but optional
A letters (uppercase or lowercase) and digits
S only letters (uppercase or lowercase)

and in your component

Custom pattern for this

You can define custom pattern and specify symbol to be rendered in input field.

You can add prefix to you masked value

You can add suffix to you masked value

dropSpecialCharacters (boolean | string[])

You can choose if mask will drop special character in the model, or not, default value is true .

You can choose if mask is shown while typing, or not, default value is false .

You can choose if mask will allow the use of negative numbers. The default value is false .

If the showMaskTyped parameter is enabled, this setting customizes the character used as placeholder. Default value is _ .

You can choose clear the input if the input value not match the mask, default value is false .

Pipe with mask expression and custom Pattern ([string, pattern])

You can pass array of expression and custom Pattern to pipe.

and in your component

You can pass into mask pattern with brackets.

You can divide your input by thousands, by default will seperate with a space.

For separate input with dots.

For using decimals enter . and how many decimals to the end of your input to separator mask.

For limiting decimal precision add . and the precision you want to limit too on the input. 2 is useful for currency. 0 will prevent decimals completely.

For limiting the number of digits before the decimal point you can set separatorLimit value to 10, 100, 1000 etc.

You can validate your input as 24 hour format.

awesome ngx mask