Edit: the difficult thing here is that I can't change the class of the third party component. I need to add styles to the class mat-form-field-wrapper dynamically, which is part of a third-party (angular material) component
So let's say I have a component, "app-search-bar", which contains an angular-material "mat-form-field" that I want to style a particular way depending on where the search bar appears in my app. I know I can style third-party components using ::ng-deep and the !important flag but is there any way for me to apply such styles dynamically in different contexts?
What I'd like is a way to do something like this:
search-bar.component.ts:
export class SearchBarComponent {
@Input() styles;
search-bar.component.scss
::ng-deep .mat-form-field-wrapper {
width: styles.width;
}