![]() |
VOOZH | about |
In this article, we will see how to style the host element of the component in AngularJS, along with knowing the basic implementation through the examples. This task can be accomplished by implementing the ng-style directive with the element. CSS properties help in the styling of the component.
Approach: Styling of host components uses CSS properties, which can be altered, modified, and updated whenever needed. The CSS properties are listed as follows:
Syntax:
<element ng-style="property"></element>
Example 1: This example uses an ng-style directive. CSS properties of font color and background color are used here.
Output:
Example 2: This example shows the styling of components based on font-size, font-color, and background color.
Output: