An Interest In:
Web News this Week
- April 18, 2024
- April 17, 2024
- April 16, 2024
- April 15, 2024
- April 14, 2024
- April 13, 2024
- April 12, 2024
January 29, 2023 04:35 pm GMT
Original Link: https://dev.to/alaa_courdova/using-styles-and-styleurls-component-properties-in-angular-423c
Using Styles and StyleUrls Component Properties in Angular
Problem
repeating a style is common while coding , for example: - container , font-style buttons ..etc.
As angular component is separated (CSS and HTML) , We face a repetitive code and if we need to change a style we needs to change many time for minor change -maybe-
Solution
styleUrls: ['./component1.scss',
'../component2.scss']
@Component({ selector: 'component', templateUrl: './component.html', styleUrls: ['./component1.scss', '../component2.scss']})export class Component implements OnInit { ngOnInit(): void { }}
so if the style we need is existing in a different component we can add the path of CSS , better than copying the style code
Original Link: https://dev.to/alaa_courdova/using-styles-and-styleurls-component-properties-in-angular-423c
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To