Search code examples
angulartwitter-bootstrapdatepickerpopover

Disable onClick for DatePicker in Popover


I have a issue where I have popover being displayed inside the popover I am providing a datepicker where user can select a date and perform some action. But when the user clicks on datepicker it expands out of the popover and once the user selects any date it hides the popover. I do want to hide the popover on any click outside the popover but not when the date is being selected, I did try stopPropogation, preventDefault but that didnt help.

Below is the stackblitz https://stackblitz.com/edit/angular-jdyico?file=src%2Fapp%2Fhello.component.ts Once you click on Should Mimic this button you should see the popover


Solution

  • You can put the ngbDatepicker node inside the popover node with [autoClose]="'outside'" and it will not close on click.