javascript - angular 4.0.0 novalidate attribute -
after migrating angular 4 strange issue template-driven form has occured. required
attr on input seems broken. suppose has novalidate
attribute default. need html5 validations. tried novalidate="false"
had no success. there way enable validation? seems using reactive forms validators.required
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>
to enable html5 validation use
<form (submit)="savephone(phone);" ngnativevalidate>
Comments
Post a Comment