Created
November 5, 2019 11:16
-
-
Save armanozak/f48fb328a98791b1e4977a4e8a278be0 to your computer and use it in GitHub Desktop.
Adaptive Components - Using :host-context Selector to Set a Style Based on Context #blog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ChangeDetectionStrategy, Component } from '@angular/core'; | |
@Component({ | |
selector: 'app-card-title', | |
changeDetection: ChangeDetectionStrategy.OnPush, | |
template: ` | |
<h5 class="card-title"> | |
<ng-content></ng-content> | |
</h5> | |
`, | |
styles: [ | |
` | |
:host-context(app-card-horizontal) h5 { | |
border-bottom: 1px solid #eee; | |
} | |
`, | |
], | |
}) | |
export class CardTitleComponent {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment