angular2 how to use ng-template from a different file? When I place the ng-template within the same HTML where I use it works but when I move ng-template into a separate file th
You can use something like this (template is used from another component):
@Component(
template: ' '
)
export class MessageTemplate {
infoMessage: InfoMessage;
}
@Component(
....
)
export class InfoMessage{
@ContentChild('columnTemplate') template: TemplateRef;
constructor(private messageTemplate: MessageTemplate) {
messageTemplate.infoMessage = this;
}
}