Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(popover): allow autoClose to be dynamic (#4680) #4695

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shyamal890
Copy link

Fixes #4680

Not sure if I should have updated the demo code for the reviewer. Regardless, here are two files you can modify to confirm that the functionality operates correctly.

popover-autoclose.html (Only changed part of the file)

      <li class="mb-2">
		click outside:
		<button
			type="button"
			class="btn btn-outline-secondary"
			popoverTitle="Pop title"
			[autoClose]="auto_close ? 'outside' : false"
			ngbPopover="pop1Content"
			#p="ngbPopover"
		>
			Click to toggle
		</button>
		<ng-template #pop1Content> Some information - </ng-template>
		<button type="button" class="ms-2 btn btn-outline-secondary" (click)="auto_close = !auto_close; cdr.detectChanges()"
			>Toggle AutoClose</button
		>
	</li>

popover-autoclose.ts

import { ChangeDetectorRef, Component } from '@angular/core';
import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap';

@Component({
	selector: 'ngbd-popover-autoclose',
	standalone: true,
	imports: [NgbPopoverModule],
	templateUrl: './popover-autoclose.html',
})
export class NgbdPopoverAutoclose {
	auto_close = false;

	constructor(public cdr: ChangeDetectorRef) {}
}

Before submitting a pull request, please make sure you have at least performed the following:

  • read and followed the CONTRIBUTING.md and DEVELOPER.md guide.
  • built and tested the changes locally.
  • added/updated any applicable tests.
  • added/updated any applicable API documentation.
  • added/updated any applicable demos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Popover autoClose not dynamic
1 participant