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

195
Vistas
Angular: using browser's html5 native build in validation error messages

Is there a way to use browser's native html5 validation error messages and use them in angular way?

what I would like is to when having like a reactive form like this:

testForm: FormGroup = this.fb.group({
  postCode: [{ value: 'postcode', disabled: true }],
  name: ['John'],
  city: [{ value: 'London', disabled: false }, [Validators.required, Validators.minLength(3)]],
});

to be able to use the native error messages in the form like:

<form [formGroup]="testForm" #myForm="ngForm">
  <input type="text" formControlName="city" >
  <div class="errors">
    <p *ngFor="let errorCode in myForm.controls.city.errors">
      {{ getBrowserNativeErrorMessage(errorCode) }}
    </p>
  </div>
</form>
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can use ngNativeValidate attribute in the form tag

<form ngNativeValidate>
</form>

But I don't think Reactive form Validators will work with this, you will have to use html native validation attributes

<input type="text" minlength="3" required>
over 4 years ago · Santiago Trujillo 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