[Angular2 Form] Validation message for Reactive form
2024-08-31 19:25:33
<div class="form-field">
<label>Confirm Password: </label>
<input type="text" formControlName="confirm" [(ngModel)]="signup.confirm" name="confrim">
<div *ngIf="!signupForm.valid">
<span *ngIf="signupForm.get('confirm').hasError('confirmPassword') && signupForm.get('confirm').touched">
{{signupForm.get('confirm').errors?.confirmPassword.message}}
</span>
<span *ngIf="signupForm.get('confirm').hasError('required') && signupForm.get('confirm').dirty">This field is requred</span>
</div>
</div>
'signupForm' is a formGroup.
we can use 'hasError' & 'get()' methods to write the code.
最新文章
- JKS和PKCS#12
- Springsecurity3.1.3配置多个登陆页面
- Java并发编程底层实现原理 - volatile
- Xcode7.3更新后插件失效的解决方法
- KO+bootstrap 模态窗全选绑定
- [HIHO1039]字符消除(字符串,枚举,模拟)
- Freemarker例子
- adb shell settings ....
- Oracle“死锁”模拟
- Codeforces Round #324 (Div. 2) B. Kolya and Tanya 快速幂
- ASP.NET中扩展FileUpload的上传文件的容量
- Android ListView滑动底部自动加载更多
- EBS R12安装升级(FRESH)(一)
- Zookeeper集群搭建步骤及相关知识点深入了解
- unity最基本操作
- Coursera Deep Learning 2 Improving Deep Neural Networks: Hyperparameter tuning, Regularization and Optimization - week1, Assignment(Initialization)
- kali linux 更新问题
- 内存栈与堆的区别C#
- 借用HTML5 插入视频。音频
- web service初探
热门文章
- JS实现下拉菜单的功能
- Python的正则表达概述
- groupmod---更改群组识别码或名称
- 【2017 Multi-University Training Contest - Team 4】Counting Divisors
- [AngularFire] Resolve snapshotChanges doesn&#39;t emit value when data is empty
- Oracle APEX 4.2公布RESTful Webservice
- 漫话C++之string字符串类的使用(有汇编分析)
- 李笑来~执行力WWH
- MYSQL存储过程中 使用变量 做表名--转
- element-UI实现el-table-column百分比自定义分配