Ich benutze ngx-bootstrap datepicker, der daypicker, monthpicker und yearpicker als innere Komponente hat. Ich möchte css auf eine Tabelle anwenden, die in daypicker vorhanden ist.Angular2 css basierend auf dem Namen des Komponentenselektors anwenden
<custom-datepicker>
<datepicker> //ngx-bootstrap datepicker component
<daypicker>
<table>
//rows, want to apply some css to only this table
</table>
</daypicker>
<monthpicker>
<table>
//rows
</table>
</monthpicker>
<yearpicker>
<table>
//rows
</table>
</yearpicker>
</datepicker>
</customdatepicker>
CustomDatePickerComponent.ts
@Component({
selector: 'custom-datepicker',
templateUrl: 'custom-datepicker-component.html',
styleUrls: ['custom-datepicker-component.scss'],
})
export class CustomDatePickerComponent {
}
custom-Datepicker-component.html
<datepicker></datepicker>
custom-Datepicker-component.scss
//I want to apply this css to a table which is inside daypicker. As of now it's applying to all the tables
table {
border: 1px solid lightgrey;
}
Werfen Sie einen Blick auf '/ deep /'. –