Assume we have this simple component here, and what we want is to apply some styling to our component, but to the actual host context styling -- to the host tag of our component -- but only if some of its ancestors has a specific styling tag.
If our component here is wrapped in a div with styled component -- with a class that is named styled component -- then we want to have a border on our host context styling tag.
We can go inside our component again -- here, we can use the style property -- and define that styled component style. We simply do something like one pixel, solid black, and display it block to see some styling.
This isn't enough, because this style would only be valid within this component here, and it wouldn't be applied depending on some ancestor-styled class here. For instance, that styled component class.
What we can do instead here is to use the host context meter tag and wrap our style in that tag. Now, if we save again, we can see how the style gets correctly applied to our component.
In the very same manner, we may want to style some of our child components rather than our ancestors. For instance, take this simple child component here, which has a simple tag inside there. If you now instantiate that child component within our host context component, we see that the component gets rendered properly.
Now, one could go here and say we want to style all tags with a background color of yellow. Again, as you can see, strange enough, this doesn't get applied to our child component. The reason is that this style here gets scoped only to this component here.
Obviously, in Angular, there is a solution for applying such styles. What we can do here is to use the host selector, and then we can use the so-called /deep/ selector, which is also often called the shadow-piercing descendant combinator.
What this special syntax here allows us is to escape the scoping of our component here and dive into the child component here and style tags inside there. If we save this, we can see that the style gets properly applied now.
There is a problem associated with this /deep/ selector. It was initially introduced by the Blink team, but meanwhile, it has been deprecated by the W3C, and there is no standard so far.
In order to avoid problems with other tools such as SASS and so on, which are going to deprecate that feature in there as well, the Angular team has introduced so-called ::ng-deep tag, starting from Angular version 4.3.1. As you can see here as well, the style gets correctly applied.
As a general rule of thumb, you should try to avoid such /deep/ selectors whenever you can. If you really have to use them, start to use the ::ng-deep selector until there is some official standard coming out.