After switching to angular 4, there was a strange problem with my template driven form. My required
attr at the entrance seems to be broken. I assume that the default attribute novalidate
. But I need some html5 checks. I tried novalidate="false"
, but did not succeed. Is there a way to activate verification? Now it seems that using reactive forms with it Validators.required
is the only way.
Thanks!
My HTML 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>
source
share