是否可以在angular2中设置为无效的表单控件? (用过的表单构建器)
eg. i have form-> exampleFrom & field-> exampleControl
我试过这个,没有成功:
this.exampleFrom.controls['exampleControl'].invalid
尝试
let control = this.exampleFrom.controls['exampleControl']; control.setErrors({backend: {someProp: "Backend message"}}); let message = control.errors['backend'].someProp;