Last active
January 21, 2020 17:36
-
-
Save argentinaluiz/e019c0b2049068daee715317a4d38ad2 to your computer and use it in GitHub Desktop.
Angular Modal Body with ContentChild
This file contains hidden or 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 { Component, OnInit, ElementRef, ViewChild, TemplateRef, ContentChild } from '@angular/core'; | |
@Component({ | |
selector: 'app-modal-body', | |
template: '<ng-container *ngTemplateOutlet="template; context: contextExp"></ng-container>', | |
styles: [] | |
}) | |
export class ModalBodyComponent implements OnInit { | |
public contextExp = { | |
nome: '' | |
}; | |
//@ViewChild('container', {static: false}) container: TemplateRef<any>; | |
@ContentChild('container', {static: false}) template: TemplateRef<any>; | |
constructor(private element: ElementRef) { } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment