Changing the Background Color of a Angular Component Host Element | Task

Ole Ersoy
Aug - 16  -  1 min

Scenario

We want to apply the color red to the background of a :host selected element.

Approach

Set the display property of the :host selected element to something other than inline (The default) setting.

:host {
    display:block;
    background-color: red;
}

The background color for the :host element will now turn red.

Demo