Created
December 24, 2016 23:38
-
-
Save shumbo/73400ee836c2bf4b977c4f4badbfadee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Injectable, | |
ViewContainerRef, | |
Component, | |
ViewChild, | |
Directive, | |
AfterViewInit | |
} from '@angular/core'; | |
import { Modal } from './modal.service'; | |
@Directive({ | |
selector: '[appModalInner]', | |
}) | |
export class ModalInnerDirective { | |
constructor(public vcr: ViewContainerRef) { | |
} | |
} | |
@Component({ | |
selector: 'app-modal-entry', | |
template: ` | |
<div class='bg' [class.active]="modal.isShow()"> | |
<div appModalInner></div> | |
</div> | |
`, | |
providers: [ModalInnerDirective], | |
}) | |
export class ModalEntryComponent implements AfterViewInit { | |
@ViewChild(ModalInnerDirective) private inner: ModalInnerDirective; | |
constructor( | |
public modal: Modal | |
) { | |
} | |
ngAfterViewInit() { | |
this.modal.vcr = this.inner.vcr; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment