Topic: Validate form on button click
Dawid Adach
pro answered 8 years ago
Dea jimsgroup,
You can use "dirty" for that and built in ngForm validation using i.e. myForm.valid as below:
<form #myForm="ngForm" (ngSubmit)="register(myForm)" novalidate>
<p>Is "myForm" valid? {{myForm.valid}}</p>
<div class="md-form">
<i class="fa fa-user prefix grey-text"></i>
<input type="text"id="form3" class="form-control"mdbActive ngModel required name="name">
<labelfor="form3">Your name</label>
</div>
<div class="text-center">
<button class="btn btn-unique waves-light"mdbRippleRadius>Send <i class="fa fa-paper-plane-o ml-1"></i></button>
</div>
</form>
You can find more detailed validation technics in following article:
https://www.toptal.com/angular-js/angular-4-forms-validation
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No