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

122
Views
Atributo de novalidación angular 4.0.0

Después de migrar a angular 4, se produjo un problema extraño con mi formulario basado en plantillas. Mi attr required en la entrada parece estar roto. Supongo que tiene el atributo novalidate por defecto. Pero necesito algunas validaciones de html5. Probé novalidate="false" pero no tuve éxito. ¿Hay alguna forma de habilitar la validación? Ahora parece usar formularios reactivos con sus Validators.required . Requerido es la única forma.

¡Gracias!

Fragmento de código de mi componente HTML:

 <form (submit)="savePhone(phone);" novalidate="false"> <h3>Новый телефон</h3> <md-input-container> <input mdInput placeholder="Номер телефона" onlyNumber="true" name="number" [(ngModel)]="phone.number" required> </md-input-container> <md-select placeholder="Источник получения" (ngModel)="phone.source" name="source"> <md-option *ngFor="let source of sources" [value]="source"> {{ source }} </md-option> </md-select> <textarea name="comment" placeholder="Текст комментария" [(ngModel)]="phone.comment" name="comment"> </textarea> <div layout="row" layout-align="end"> <button class="button button--success" type="submit"> Добавить </button> </div>

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Para habilitar el uso de la validación de HTML5

 <form (submit)="savePhone(phone);" ngNativeValidate>

Consulte también la fuente de NgNoValidate en GitHub

about 4 years ago · Santiago Trujillo Report
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!