Closed vicabelotelova closed 6 years ago
Hey everybody! I have a problem with auto complete and my validation
i have form group and control in My html
<div class="form-group" [formGroup]="CreateObject"> <label class="col-md-4 control-label" for="adress">Region<span class="RedStar">*</span>:</label> <div class="form-group col-md-6" [class.has-error]="isControlValid('RegionControl')"> <div ngui-auto-complete formControlName="RegionControl" [source]="RegionsArray" [list-formatter]="autocompleListFormatter" (valueChanged)="searchCitiesInBase($event)" display-property-name="FullName" > <input class="form-control" > <p class="text-danger" *ngIf="isControlValid('RegionControl')">Error</p> </div> </div> </div>
And my ts file
buildForm(){ this.CreateReObject = this.formBuilder.group({ RegionControl: this.formBuilder.control('', Validators.required) }); isControlValid(control: string){ return !this.CreateReObject.get(control).valid && this.CreateReObject.get(control).touched; }
Перевести
when i was touched input and chose a option. Validators.required said this input is invalid. Why is it happend? And how i will can fix it
Plz . this is very important in my project
Hey everybody! I have a problem with auto complete and my validation
i have form group and control in My html
And my ts file
Перевести
when i was touched input and chose a option. Validators.required said this input is invalid. Why is it happend? And how i will can fix it