Sunday, October 22, 2017

Angular 4. What is :host in angular CSS?

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.

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/10/22/angular-4-what-is-host-in-angular-css/
via @lzomedia #developer #freelance #web #lzomedia.com

No comments:

Post a Comment