Angular 2 doesn't import Bootstrap css
If you're using angular-cli, you can go to root/styles.css
and add this line
@import "../node_modules/bootstrap/dist/css/bootstrap.min.css";
Or go to .angular-cli.json
and modify styles
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.css"
]
It is working when index.html
is in the same directory as node_modules
.
To add bootstrap from angular-CLI put
'bootstrap/dist/**/*.+(js|css.map|css|eot|svg|ttf|woff|woff2)'
in angular-cli-build.js
and run ng build
If you use angular-cli after the webpack transition, add
"../node_modules/bootstrap/dist/css/bootstrap.css"
to the styles
array in angular-cli.json
like:
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.css"
],
If you also use bootstrap javascript, add those files to the scripts
array.