0

I am learning Angular right now. In the tutorial, I'm supposed use Bootstrap:

<ul class="nav nav-pills">
    <li class="active"><a href="">Map View</a></li>
    <li><a href=""></a>List View</li>
</ul>
<div>
    <div>Map View Content</div>
</div> 

In order to output this: enter image description here

Instead, I got this: enter image description here

I can see that Bootstrap did not work. So I checked to see if Bootstrap and jQuery are installed, which they are (both in node_modules folder): enter image description here enter image description here

I checked to see if I imported right. I tried two ways. First, I imported Bootstrap on styles.css Like this:

@import "~bootstrap/dist/css/bootstrap.css"

It did not work. So I tried another way by adding Bootstrap and jQuery on angular.json file like this:

"styles": [
      "styles.css",
      "./node_modules/bootstrap/dist/css/bootstrap.min.css"
],
"scripts": [
      "./node_modules/jquery/dist/jquery.min.js",
      "./node_modules/bootstrap/dist/js/bootstrap.min.js"
]

enter image description here

My Question is: are there any extra steps that I might be missing? I have looked at many sources already and it seems like I have everything correct. Are there better alternatives out there to get Bootstrap to display properly? I'm really confused and I would appreciate any help I can get. Thank you!

1 Answer 1

1

Try removing the “./“ at the beginning:

"styles": [
  "node_modules/bootstrap/dist/css/bootstrap.min.css",
  "src/styles.scss"
],
"scripts": [
  "node_modules/jquery/dist/jquery.min.js",
  "node_modules/bootstrap/dist/js/bootstrap.min.js"
]
Sign up to request clarification or add additional context in comments.

2 Comments

I tried this, but still doesnt work unfortunately
How so? Can you share an screenshot of your folder structure?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.