Skip to content

Commit 9164650

Browse files
feat(MdePopoverTrigger): add mdePopoverBackdropCloseOnClick option, closes #36
1 parent 242a112 commit 9164650

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

projects/material-extended/mde/src/lib/popover/popover-trigger.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ export class MdePopoverTrigger implements AfterViewInit, OnDestroy { // tslint:d
108108
@Input('mdePopoverCloseOnClick') closeOnClick: boolean;
109109

110110

111+
/** Popover container close on click */
112+
@Input('mdePopoverBackdropCloseOnClick') backdropCloseOnClick = true;
113+
111114
/** Event emitted when the associated popover is opened. */
112115
@Output() opened = new EventEmitter<void>();
113116

@@ -231,7 +234,7 @@ export class MdePopoverTrigger implements AfterViewInit, OnDestroy { // tslint:d
231234
this._createOverlay().attach(this._portal);
232235

233236
/** Only subscribe to backdrop if trigger event is click */
234-
if (this.triggerEvent === 'click') {
237+
if (this.triggerEvent === 'click' && this.backdropCloseOnClick === true) {
235238
this._subscribeToBackdrop();
236239
}
237240

@@ -245,7 +248,7 @@ export class MdePopoverTrigger implements AfterViewInit, OnDestroy { // tslint:d
245248
this._overlayRef.detach();
246249

247250
/** Only unsubscribe to backdrop if trigger event is click */
248-
if (this.triggerEvent === 'click') {
251+
if (this.triggerEvent === 'click' && this.backdropCloseOnClick === true) {
249252
this._backdropSubscription.unsubscribe();
250253
}
251254

0 commit comments

Comments
 (0)