Search code examples
angulardatetimenpmattributesgetelementbyid

How to select angular npm package datetimepicker in ts file ?


document.getElementById and document.querySelector are not returning any results ...
This is html element I'm trying to get and set new attribute at certain event

<datetime id="datePicker" [datepicker]="datePickerOptions" 
[(ngModel)]="treasury.date" name="date" [timepicker]="false" ></datetime>

Any idea how can i access this element in .ts file ?


Solution

  • I did it using @ViewChild ,and then loging the ViewChild because normal console.log isn't working on this kind of component . good material to learn ViewChild in angular