Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<ng-container [ngSwitch]="buttonType">
<ng-container *ngSwitchCase="'Primary'">
<app-primary-button>
<ng-container *ngTemplateOutlet="contentTpl"></ng-container>
</app-primary-button>
</ng-container>
<ng-container *ngSwitchCase="'Secondary'">
<app-secondary-button>
<ng-container *ngTemplateOutlet="contentTpl"></ng-container>
</app-secondary-button>
</ng-container>
<ng-container *ngSwitchDefault>
<app-default-button>
<ng-container *ngTemplateOutlet="contentTpl"></ng-container>
</app-default-button>
</ng-container>
</ng-container>
<ng-template #contentTpl>
<ng-content></ng-content>
</ng-template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.