Reputation: 1025
In d3, I make a lot of elements like this:
this.title = svg.append('text')
.attr('class', 'graph-title')
.text('blah blah blah');
I was hoping I could put that class in the CSS local to the component creating this svg, but you can't refer to the local css this way. What I did above would only work if I put the relevant style into the global CSS, which for reusability reasons is not what I'd like to do.
Is there some way I can programmatically add the local css class to this dynamically-created element?
Upvotes: 1
Views: 131
Reputation: 657516
You can use >>>
(or /deep/
) to address dynamically added elements that don't get the encspsulation attributes (_ng_content...
) added from styles added to components:
:host >>> graph-title {
...
}
Upvotes: 1