Reputation: 1960
I have a fresh created Angular 4 CLI app with the following packages installed:
npm install [email protected] jquery tether popper.js --save
.angular-cli.json extraction:
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.slim.min.js",
"../node_modules/tether/dist/js/tether.min.js",
"../node_modules/popper.js/dist/umd/popper.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.min.js"
],
With this setup I have a navbar component with the html code from the official Bootstrap 4 page which is not rendering properly: It has a toggle button even when a browser is in full screen mode, background color is missing, "Navbar" and toggler are swapped.
However, it works perfectly when I use Bootstrap 4 CDN. Any other styles except for the navbar work as expected in both cases.
So, what am I doing wrong when working with Bootstrap installed locally?
Upvotes: 0
Views: 6542
Reputation: 824
Use this config in angular.json. Notice how we use node_modules/popper.js/dist/umd/popper.min.js. This seems to work.
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/popper.js/dist/umd/popper.min.js",
"node_modules/bootstrap/dist/js/bootstrap.min.js"
]
All the best !
Upvotes: 0
Reputation: 319
It happens due to bootstrap version incompatibility, to get around, in styles.css, add this line:
@import url('https://unpkg.com/[email protected]/dist/css/bootstrap.min.css');
Upvotes: 4
Reputation: 461
It sounds there is a breaking change with css in 4.0.0-Beta.
https://github.com/bootstrap-vue/bootstrap-vue/issues/812
Just downgrade your bootstrap version as well:
npm install [email protected] --save
Note: the CDN you tried is using apha.6 that why it was working :)
Upvotes: 3