Expose a service for applying mask in typescript
See original GitHub issuePlease advise how to apply a mask in typescript code.
Correct me if I am wrong, but I do not see any exposed service that I can use to do this. MaskService cannot be injected into a service, because it requires an ElementRef, which throws an error on injection NullInjectorError: No provider for ElementRef!
.
There is another service MaskApplierService, but it is not exposed in the public_api. In any case there is no documentation on the difference between these two services.
If it is not currently possible to apply the mask outside of an Angular template, please add as a feature the correct service to use, or a utility class that can be imported. The use case is for data export.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to Use Input Masks to Validate Input in an Angular App
Input validation is always a chore to set up. An input mask is a way to enforce the format of the user's input...
Read more >How to apply mask to a default value in Typescript
I have a mask-phone directive that works perfectly in the input when the user write a value, but I need to set a...
Read more >Google TypeScript Style Guide
This guide is based on the internal Google TypeScript style guide, ... Note: If you're creating an alias just to expose it to...
Read more >tslog - Extensible TypeScript Logger for Node.js and Browser ...
Extensible TypeScript Logger for Node.js and Browser: Dependency free, Fully customizable, Pretty errors, stack traces, and JSON output to attachable ...
Read more >ngx-mask - npm
Import ngx-mask directive, pipe and provide NgxMask providers with provideNgxMask function. With default config options application level. bootstrapApplication( ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@kevinrstone @douggass we fixed this , you can use in mask 7.9.8 version For using you should use MaskApplierService Example:
work when I import ‘ea’: import { ɵa } from ‘ngx-mask’; … constructor(private maskApplierService: ɵa) {
console.log(maskApplierService.applyMask(‘5555’, ‘00-00’)); } …
thank you