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 mino…


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Alaa Courdova

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


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Alaa Courdova


Print Share Comment Cite Upload Translate Updates
APA

Alaa Courdova | Sciencx (2023-01-29T16:35:49+00:00) Using Styles and StyleUrls Component Properties in Angular. Retrieved from https://www.scien.cx/2023/01/29/using-styles-and-styleurls-component-properties-in-angular/

MLA
" » Using Styles and StyleUrls Component Properties in Angular." Alaa Courdova | Sciencx - Sunday January 29, 2023, https://www.scien.cx/2023/01/29/using-styles-and-styleurls-component-properties-in-angular/
HARVARD
Alaa Courdova | Sciencx Sunday January 29, 2023 » Using Styles and StyleUrls Component Properties in Angular., viewed ,<https://www.scien.cx/2023/01/29/using-styles-and-styleurls-component-properties-in-angular/>
VANCOUVER
Alaa Courdova | Sciencx - » Using Styles and StyleUrls Component Properties in Angular. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/01/29/using-styles-and-styleurls-component-properties-in-angular/
CHICAGO
" » Using Styles and StyleUrls Component Properties in Angular." Alaa Courdova | Sciencx - Accessed . https://www.scien.cx/2023/01/29/using-styles-and-styleurls-component-properties-in-angular/
IEEE
" » Using Styles and StyleUrls Component Properties in Angular." Alaa Courdova | Sciencx [Online]. Available: https://www.scien.cx/2023/01/29/using-styles-and-styleurls-component-properties-in-angular/. [Accessed: ]
rf:citation
» Using Styles and StyleUrls Component Properties in Angular | Alaa Courdova | Sciencx | https://www.scien.cx/2023/01/29/using-styles-and-styleurls-component-properties-in-angular/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.