I have get a warning like this
Warning: Unable to locate stylesheet: D:\Angular\certification\Angular8Certification\https:\stackpath.bootstrapcdn.com\bootstrap\4.4.1\css\bootstrap.min.css
I am new to Angular. When I add css It did not apply. What is the reason and what should I want to do?
Here is my console
This error tells you, that you have not imported the angular HttpClient Module into your (root) module. To resolve the problem, you need to import the missing module into your module. Most of the cases, that module would be the AppModule in your app directory.
I created an Angular project using the CLI. I’m using SCSS, and I included Angular Material with a custom theme iirc. I added a couple dummy components, and the app still built fine. Then I needed to style my components using Angular Material.
The most common reason, is, that the browser has not finished creating it and has not yet added it to the DOM. If you try to use it before it has been added, it will not work and crash your app. If you are familiar with JavaScript in general, you have probably stumbled across that problem, as it is not specific to angular.
Especially when you are a beginner, these problems can turn the development process with angular into a real pain. But trust me, it does not have to be painful. In fact, I think angular development is one of the smoothest development experience I had so far.
Edit:
This warning is caused by new update in polyfills.
Solution is:
Remove all bootstrap cdn links from index.html
Install bootstrap >
npm install bootstrap
Next, go the angular.json file and add the paths of Bootstrap CSS and JavaScript files to the styles and scripts arrays under the build target as follows:
ng serve --open
again.
Result
This solution worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With