0

I wrote the bind script ngAfterViewInit, still is binding to undefined, where to call after the input loaded to DOM

HTML

<input type="text" *ngIf="showLastContactedDate" #dateRangeLastContacted placeholder="Choose Period" (cancelDaterangepicker)="calendarCanceled($event)" (applyDaterangepicker)="calendarApplied($event)" 
 daterangepicker [options]="options"/>

TS

export class FilterContactsDialogComponent implements OnInit, AfterViewInit {
    @ViewChild('dateRangeLastContacted') dateRangeLastContacted;

    ngOnInit() {}

    ngAfterViewInit(){


    response = //calling a service method
        setTimeout(() => {
            this.dateRangeLastContacted.nativeElement.value = response.someValue;
        },0);
    }
}
Mohammad Fareed
  • 1,927
  • 6
  • 26
  • 59

0 Answers0