I am learning Angular2 CLI into my http://localhost:4200/. I followed https://cli.angular.io/ the tutorial and installed Angular2 successfully.
I have the problem with importing bootstrap4 css in this. I have tried the following code into my src/angular.json file.
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css",
"src/assets/css/bootstrap.min.css",
"src/assets/css/style.css"
],
"scripts": [
"src/assets/js/jquery.min.js",
"src/assets/js/bootstrap.min.js"
],
I have added the bootstrap sample navbar into my app.component.html
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
</ul>
</div>
</nav>
I am getting the
[WDS] Disconnected!error in my local.

I have tried adding import 'src/assets/css/bootstrap.css'; into my style.css but its working as a inline style not getting desired output.
If I tried to include index.html header using <link src="" its working but I don't want to use this method. Any help will be appreciated. Thanks in Advance.
Try this command,
npm install bootstrap@4 jquery --save
After edit the Angular.json file modify `"style"
["node_modules/bootstrap/dist/css/bootstrap.css"]`
&
"script:["/node_modules/jquery/dist/jquery.js"]`and ["node_modules/bootstrap/dist/ js/boostrap.js"`]
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