Skip to main content

Posts

Showing posts with the label How to use styleUrls and styles in Angular 2?

How to use styleUrls and styles in Angular 2?

The Angular 2 “ styles ” or “ styleUrls ” should only be used for  css rules  and it is affect the style of the template elements. This is the best approaches to add styles directly to the components and the view encapsulation is set per component. It is use for some situations. Stayed Informed – Angular 2 Documentations and Examples An example to add external styles to the components result text color is red, Syntax – @ Component({ selector : 'home' , templateUrl : './home.component.html' , styleUrls : [ './home.component.css' ], styles : [ '.tbl-row-border { border: 1px solid red;}' , '.txt-color{color:red;}' ] }) home.component.html :- < div class = "row" > < div class = "col-lg-12" > < div class = "ibox float-e-margins" > < div class = "ibox-title" > < h5 > Angular 2 for loop typescript example - * ngFor < ...