This is how my div looks like inside html:
<div class="form-group col">
<label for="randomName" class="mb-1">Test</label>
<ngb-timepicker id="randomName" name="start" [(ngModel)]="startTime"
[acSmallestTimeUnit]="this.smallestTimeUnit"
[acSmallestTimeUnitEnabled]="this.smallestTimeUnitEnabled" [spinners]="false"
#start="ngModel"></ngb-timepicker>
</div>
I use a template driven approach for custom validation here. Whenever i change the value of another html element, i would like to trigger the validation of the start element manually. I do that by using the method updateValueAndValidity(). Like this:
<select (change)="onChange(); start.control.updateValueAndValidity();"
id="random" class="form-control" #project name="project"
[(ngModel)]="projectName" #project="ngModel" tabIndex="0" required>
The problem is, i have to call start.control.updateValueAndValidity() after onChange(). But onChange() is asynchronous so in order to call start.control.updateValueAndValidity() after onChange() i would like to call it at the end of the onChange() method which is written in typescript using async and await. I would like to know how to transform the start.control.updateValueAndValitiy() to typescript code so i can call it there, i do not really know how to get the start value. I tried multiple things including document.getElementByName() etc., but nothing worked yet.
start.control.updateValueAndValidity()intoonChangeand call it in proper place?