Skip to content

Commit 32867af

Browse files
committed
fix(backdrop.service): separate css classes for modal and offcanvas
1 parent 1924159 commit 32867af

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

projects/coreui-angular/src/lib/backdrop/backdrop.service.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ export class BackdropService {
2020
this.renderer = rendererFactory.createRenderer(null, null);
2121
}
2222

23-
setBackdrop(): any {
24-
const backdrop = this.renderer.createElement('div');
25-
this.renderer.addClass(backdrop, 'modal-backdrop');
26-
this.renderer.addClass(backdrop, 'fade');
27-
this.renderer.appendChild(this.document.body, backdrop);
28-
this.unListen = this.renderer.listen(backdrop, 'click', (e): void => {
23+
setBackdrop(type: string = 'modal'): any {
24+
const backdropElement = this.renderer.createElement('div');
25+
this.renderer.addClass(backdropElement, `${type}-backdrop`);
26+
this.renderer.addClass(backdropElement, 'fade');
27+
this.renderer.appendChild(this.document.body, backdropElement);
28+
this.unListen = this.renderer.listen(backdropElement, 'click', (e): void => {
2929
this.onClickHandler();
3030
});
3131
setTimeout(() => {
32-
this.renderer.addClass(backdrop, 'show');
32+
this.renderer.addClass(backdropElement, 'show');
3333
});
34-
return backdrop;
34+
return backdropElement;
3535
}
3636

3737
clearBackdrop(backdrop: any): any {

0 commit comments

Comments
 (0)