Here's an example that introduces both regular Materialize select and Angular Materialize component:
@Component({
selector: 'my-app',
styles: [`
.select-wrapper {
background-color: red;
}
`],
template: `
<div class="row">
<div class="col s6">
<select materialize="material_select">
<option>...</option>
</select>
</div>
<div class="col s6">
<select class="non-angular-materialize">
<option>...</option>
</select>
</div>
</div>
`,
})
export class App {
ngOnInit() {
$('.non-angular-materialize').material_select();
}
}
Styles are not applied.
Although same example works with /deep/, this defies the purpose of components:
:host /deep/ .select-wrapper {
background-color: red;
}
Why does this happen? Is it possible to keep CSS encapsulation and avoid /deep/ when styling the elements of component template? Is this problem specific to Materialize?