diff --git a/utils/modal-select/modal-select.directive.ts b/utils/modal-select/modal-select.directive.ts new file mode 100644 index 00000000..4db5b52b --- /dev/null +++ b/utils/modal-select/modal-select.directive.ts @@ -0,0 +1,17 @@ +import {Directive, Input, OnInit} from "@angular/core"; +import {MatSelect} from "@angular/material/select"; + +@Directive({ + selector: '[modal-select]' +}) +export class ModalSelectDirective implements OnInit{ + + @Input() matSelect: MatSelect; + + ngOnInit() { + this.matSelect._openedStream.subscribe( () => { + let divElement: HTMLDivElement = document.getElementsByClassName('cdk-overlay-container')[0]; + divElement.classList.add('modal-select'); + }); + } +} diff --git a/utils/modal-select/modal-select.module.ts b/utils/modal-select/modal-select.module.ts new file mode 100644 index 00000000..6620f0d5 --- /dev/null +++ b/utils/modal-select/modal-select.module.ts @@ -0,0 +1,10 @@ +import {NgModule} from "@angular/core"; +import {CommonModule} from "@angular/common"; +import {ModalSelectDirective} from "./modal-select.directive"; + +@NgModule({ + imports: [CommonModule], + declarations: [ModalSelectDirective], + exports: [ModalSelectDirective] +}) +export class ModalSelectModule {}