I've searched a lot on the internet but all the answers are using jquery
. I'm new to Angular and Typescript. This and this were not very helpful. I have created a monthpicker from the scratch. The mechanism is pretty simple and straightforward. When I click on input
field, a popup opens with all the months. I mean this:
That pop-up is actually p-overlay
from primeng
. Here is my code.
monthpicker.component.html
<textbox
(click)="openMonthpicker.toggle($event)">
</textbox>
<p-overlayPanel class="dropdown" #openMonthpicker>
HTML CODE FOR DISPLAYING MONTHS
</p-overlayPanel>
My monthpicker component is editable, that means you can enter dates through keyboard also. But while entering dates i want that pop-up to collapse back.
I added this line of code in textbox
:
<textbox
...
(keydown)="openMonthpicker.off($event)">
</textbox>
Apparently, off
is not function. I tried remove
also. But I dont know is there any function to close the event. Can someone please help me?
PS: I also read TypeScript Event Handlers.