Overview Setup Source code
@maskito/angular is a light-weighted library to use Maskito in an Angular-way.

To get the most out of this guide, you should review the topic "Core Concepts" first.

Write less code

  • No need to query element from DOM. Just pass all required options to [maskito] directive.
  • No need to worry about clean-ups. All created event listeners are automatically removed after element is detached from DOM.

Basic directive approach

Use it when you have direct access to native input element.



Nested input element

Pass a predicate to maskito to find input element for you, if you do not have a direct access to it.

By default maskito will try to find input/textarea by querying its host: host.querySelector('input,textarea') so that might be sufficient. Use custom predicate if you need custom logic.



Custom input Copy

See querying nested input in action

Default behavior is enough for Taiga UI inputs
Custom predicate is required if target input is not the first on in the DOM

Set value programmatically Copy

When directly on native input/textarea tag, MaskitoDirective formats value set programmatically with Angular forms.


Pipe Copy

Format arbitrary value with the same options

Balance: $12 345.67