how to include an external css in angular 4?
Answer / Rita Kumari
To include an external CSS file in Angular 4, you can use the following steps:
1. Place your CSS file in the 'assets' folder.
2. Import the CSS file in your component by adding `import './path/to/your/css-file.css';` at the top of your component.
3. In your component's constructor, add `this.constructor();` and call a function to initialize styles:n```typescriptnngOnInit() {n this.initializeStyles();n}nprivate initializeStyles() {n if (window.getComputedStyle(document.body).getPropertyValue('--primary-color') === null) {n document.documentElement.style.setProperty('--primary-color', 'blue');n }n}n```
| Is This Answer Correct ? | 0 Yes | 0 No |
Explain $templatecache in angularjs?
What is the difference between routermodule.forroot() vs routermodule.forchild()?
Is typescript an oop?
What is cdk in angular?
Explain .config() and .run() methods in angularjs?
What is a directive question?
What is ng build command?
What is difference between javascript and typescript?
What is typescript in Angular 8?
What classes should I not add to module's declarations?
What is templateref and viewcontainerref?
Explain the process how do we exchange the data from front end to server?