0

I have trouble understand the concept of :host selector in Angular CSS. What exactly does it do?

I looked at here https://angular.io/guide/component-styles. It starts talking "host element" and "parent component" which are equally confusing since I can't find a concrete definition online. What exactly is host element? What makes a component a parent component?

Then there is an example of :host on this blog: https://www.concretepage.com/angular-2/angular-2-4-component-styles-host-host-context-deep-selector-example But it looks like :host just creates a bunch of rectangles on top of each other??

It said "The style written in :host selector in CompanyComponent will be applied in host element in PersonComponent and so on"

But what style is applied? It just create a rectangle with :host and paste it on other template

Please I need help.

  • 1
    https://stackoverflow.com/questions/42583629/cannot-understand-the-use-of-host-in-components-in-angular2 this will help u –  Oct 22 '17 at 04:30
  • I have already looked at it. The example doesn't work and I want to know that :host does without parameter. – Jinjin DongDong Oct 22 '17 at 04:48

0 Answers0