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

113
Views
angular 4.0.0 novalidate attribute

After migrating to angular 4 a strange issue with my template-driven form has occured. My required attr on input seems to be broken. I suppose that has novalidate attribute by default. But I need some html5 validations. Tried novalidate="false" but had no success. Is there some way to enable validation? Now it seems using reactive forms with its Validators.required is the only way.

Thanks!

My HTML component code snippet:

<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

To enable HTML5 validation use

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

See also NgNoValidate source at 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!