I'm trying to apply styles to the ngbTooltip component in my Angular 2 app. I apply the directive as:
<div [ngbTooltip]="tooltipText">
Element text
</div>
But since Angular 2 applies style scoping, I can't directly style the .tooltip class in my component's template.
How can I give the tooltips for this specific component a custom styling?
EDIT:
I have a scss stylesheet that's attached to my component. My styles (simplified) are:
.license-circle {
width: 10px;
... other styles
}
/deep/ .tooltip {
&.in {
opacity: 1;
}
}
But then my rendered styles look like:
<style>
.license-circle[_ngcontent-uvi-11] {
width: 10px; }
.tooltip.in {
opacity: 1; }
</style>
Which makes me believe the tooltip styles are being un-encapsulated (instead of just piercing this component's children.
Note: I tried :host >>> .tooltip and it didn't work, so I ended up using /deep/.
Thanks!
:host ...then they are only applied to this component and it's children.css [_nghost-epe-11] { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; } .license-circle[_ngcontent-epe-11] { .... } .tooltip.in { opacity: 1; } .tooltip .tooltip-inner { padding: 0.5rem; ... }