AniketGole
AniketGole

Reputation: 1285

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"/>

Upvotes: 3

Views: 659

Answers (2)

Zlatko
Zlatko

Reputation: 19578

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.

Upvotes: 1

Orodan
Orodan

Reputation: 1047

try adding the following inside of your link tag :

type="text/css"

Best regards

Upvotes: 0

Related Questions