Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

227
Vistas
In angular-imask how do I get the IMask class?

Using Angular-IMask, I'm programatically updating the field that has IMask. So I'm getting the error:

"Element value was changed outside of mask. Syncronize mask using mask.updateValue() to work properly."

I programatically change the input because I have a datepicker associated with it (NgbDatepicker component from Angular-Bootstrap ng-bootstrap module).

How can I get imask object so I can call updateValue() ? I set the component only on the template, so I don't have any object in the component I can access.

Is there any other way to remove that message besides acessing IMask object ? if there is please let me know.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can get the IMask instance by querying for the imask directive by using the ViewChild property decorator and then you can access the IMask instance from the directive via the maskRef property.

i.e.

@Component({
  template: `
    <input type="text"
        [imask]="maskConfig"
    >
  `,
})
export class MyMaskComponent {
  maskConfig = {...}

  @ViewChild(IMaskDirective, { static: false })
  iMask: IMaskDirective<IMask.MaskedNumber>;

  ngAfterViewInit(): void {
    this.iMask.maskRef.updateValue();
  }
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

You can use ViewChild for this component or use ngOnChanges from Angular LifeCycle and filter for this refeered change to get the current object.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda