Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while loading ngx-bootstrap css on angular 5

Getting error while loading css on angular5 with ngx-bootstrap

Refused to apply style from 'http://localhost:3000/node_modules/ngx-bootstrap/datepicker/bs-datepicker.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

i have include css only in index.html <link href="../node_modules/ngx-bootstrap/datepicker/bs-datepicker.css" rel="stylesheet"/>

like image 548
AniketGole Avatar asked Aug 01 '26 23:08

AniketGole


1 Answers

You can also add the style in your .angular-cli.json, if you're using ng-cli. Then Angular CLI will take care of adding the file to index.html for you:

{
  ...
  "styles" : [
    "../../../node_modules/bootstrap/dist/css/bootstrap.min.css",
    "../../../node_modules/ngx-bootstrap/datepicker/bs-datepicker.css",
    "styles.scss",
    ...
  ],
  ...
}

Alternatively, if not angular-cli, then webpack can take care of this for you.

like image 81
Zlatko Avatar answered Aug 07 '26 05:08

Zlatko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!