Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

245
Views
In angular-imask how do I use imaskElement attribute?

I'm trying to find a way to access the imask object in Angular. I saw this attribute

[imaskElement]="(elementRef, directiveRef) => maskElement" <!-- default = elementRef.nativeElement -->

but when I try to connect it to a property in my component it doesn't work. Angular can't find elementRef and directiveRef properties in the component.

I tried to connect it to this property:

@ViewChild('MyDatePicker') myDatePicker: ElementRef;

this way:

(...)
[imaskElement]="(elementRef, directiveRef) => datePickerElement" />

Also if I try to access the default element as stated in the documentation it doesn't work. When I try this:

myDatePicker.nativeElement.updateValue() 

I get this error:

ERROR TypeError: Cannot read properties of undefined (reading 'updateValue')

How can I correctly direct imaskElement attribute to a property of my component ?

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!