Skip to content

Instantly share code, notes, and snippets.

@Dornhoth
Created June 12, 2020 16:37
Show Gist options
  • Save Dornhoth/8f3dcefbfdfe97957dcb1dcfd2fd52c5 to your computer and use it in GitHub Desktop.
Save Dornhoth/8f3dcefbfdfe97957dcb1dcfd2fd52c5 to your computer and use it in GitHub Desktop.
<app-error-card></app-error-card>
<app-error-card [template]="googleItTemplate"></app-error-card>
<ng-template #googleItTemplate>
Another error text
<div>
<a href="google.com">Google it</a>
</div>
</ng-template>
<ng-container [ngTemplateOutlet]="template || defaultTemplate">
<ng-template #defaultTemplate>
An unexpected error occurred.
</ng-template>
import { Component, TemplateRef, Input } from '@angular/core';
@Component({
selector: 'app-error-card',
templateUrl: './error-card.component.html',
styleUrls: ['./error-card.component.scss']
})
export class ErrorCardComponent {
@Input() template: TemplateRef<any>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment