Is it possible to set invalid form control in angular2? (used form builder)
eg. I have form-> exampleFrom and field-> exampleControl
I tried this, it failed:
this.exampleFrom.controls['exampleControl'].invalid
Try
let control = this.exampleFrom.controls['exampleControl']; control.setErrors({backend: {someProp: "Backend message"}}); let message = control.errors['backend'].someProp;
try this code to print a message
<div style='color:red' *ngIf="!exampleFrom.exampleControl.valid"> //set here your custom message </div>
Source: https://habr.com/ru/post/1017077/More articles:Pass two elements through the generator at the same time - pythonHide windows using the Infrastructure dialog box window - c #How to enable double dotted border? - htmlHow to correctly set application context path in angular2 routing? - angularAxisFault: the ServiceClass object does not implement the required method in the following form: OMElement add (OMElement e) - javaHow to convert converted data - rWorkers die early due to uneven distribution of work in Luigi (2.6.1) - dockerThe ServiceClass object does not implement the required method in the following form: login OMElement (OMElement e) - web-servicesHow can I use social login in jHipster REST api? - javahttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1017082/loading-data-from-rdbms-to-hadoop-with-multiple-destinations&usg=ALkJrhikgxhyx3CdchOOFLkBuhO5UvKGEgAll Articles