question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat(input): add (limited) support for text masking

See original GitHub issue

Bug, feature request, or proposal:

How can I set a text mask in date picker component so, if user doesn’t want to select a date in calendar, he can type and fill correctly the field?

What is the expected behavior?

When click on input date picker, show the mask so user can type date instead of selecting a date from calendar

What is the current behavior?

empty input

What are the steps to reproduce?

Providing a StackBlitz/Plunker (or similar) is the best way to get the team to see your issue.
Plunker starter (using on @master): https://goo.gl/DlHd6U
StackBlitz starter (using latest npm release): https://goo.gl/wwnhMV
Just add a datepicker component

What is the use-case or motivation for changing an existing behavior?

Maybe user wants to type date instead of selecting form calendar.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

@angular/cli: 1.3.0 node: 6.10.3 os: darwin x64 @angular/animations: 4.3.5 @angular/cdk: 2.0.0-beta.8 @angular/common: 4.3.5 @angular/compiler: 4.3.5 @angular/core: 4.3.5 @angular/flex-layout: 2.0.0-beta.8 @angular/forms: 4.3.5 @angular/http: 4.3.5 @angular/material: 2.0.0-beta.8 @angular/platform-browser: 4.3.5 @angular/platform-browser-dynamic: 4.3.5 @angular/router: 4.3.5 @angular/cli: 1.3.0 @angular/compiler-cli: 4.3.5 @angular/language-service: 4.3.5

Is there anything else we should know?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:5
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
benjamincharitycommented, May 9, 2018

We were able to get a mask directive working with Material inputs using the text-mask library mentioned above. You can see the code here if it’s helpful (at least until an official solution is offered).

2reactions
remborgcommented, Dec 22, 2017

Hi @WandersonAlves I can see 2 ways to do that, the first one would be to use the date pipe in the text-mask-addons lib, but you’ll likely have to create a custom pipe for some mask formats. The second way would be to do it on the angular side, catching when the input value changes and then doing a check. Not really clean I think because then the input validation is half vanilla, half angular… but as a workaround that would work. Good luck and please let me know what you go for 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

FEAT/UserGuide - FSL - FslWiki
Each one will generate its own FEAT directory, the name of which is based on the input data's filename (unless you enter an...
Read more >
Control data entry formats with input masks - Microsoft Support
Learn how to add input masks in Access to table fields, queries, and to form and report controls to help people entering data....
Read more >
Angular2 - Input Field To Accept Only Numbers - Stack Overflow
Using Angular 2, how can I use the same input control and apply some sort of filter/mask on this field, such that it...
Read more >
Mask app - Seba Online
For VA Care Teams needing assistance with telehealth and all apps. ... LTD. In this article learn about Mask R-CNN framework for image...
Read more >
Getting Started with the Basics of Input Masking - Jotform
Input Masking Scenario #1: For the first scenario, let's look at this one using a simple Short Text element, so go ahead and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found