Skip to content

Instantly share code, notes, and snippets.

@argentinaluiz
Last active January 21, 2020 17:36
Show Gist options
  • Save argentinaluiz/e019c0b2049068daee715317a4d38ad2 to your computer and use it in GitHub Desktop.
Save argentinaluiz/e019c0b2049068daee715317a4d38ad2 to your computer and use it in GitHub Desktop.
Angular Modal Body with ContentChild
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