Skip to content

Instantly share code, notes, and snippets.

@lydemann
Created September 13, 2018 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lydemann/c19ccd705e3daef0489e3699a54ba8f4 to your computer and use it in GitHub Desktop.
Save lydemann/c19ccd705e3daef0489e3699a54ba8f4 to your computer and use it in GitHub Desktop.
<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