Answer the question
In order to leave comments, you need to log in
Why is there no validation in Angular 7?
I create a form in angular, I do validation like this
<input name="Name" #Name="ngModel" [(ngModel)]="service.formData.Name"
class="form-control" placeholder="Mission naming" required maxlength="100">
<input class="form-control" maxlength="100" name="Name" required="" ng-reflect-required="" ng-reflect-maxlength="100">
Answer the question
In order to leave comments, you need to log in
Where is your validation? You declared an input and made a binding to the property of the component, and you already need to check the value inside the component.
The form will not be valid if there are more than 100 characters, and when the component is generated, the value is empty, which means all conditions are met.
Look here
https://angular.io/guide/form-validation
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question