I'm trying something very simple to understand what's going on:
ng new
npm i bootstrap
@import '~bootstrap/scss/bootstrap';
(I've also tried to add the dependencies to the angular.json file)I'm trying to create a table with a dark header (thead-dark
) and the table is being created, but the theme not applied.
Expected result
Actual result
npm i bootstrap
will install you the latest version of Bootstrap which is 5. Bootstrap 5 does not include thead-dark
class and that is why your header isn't rendering dark.
Since you are using Bootstrap 5 you should be using table-dark
class instead of thead-dark
.
See documentation at: Bootstrap 5 Tables (thead)
<table class="table">
<thead class="table-dark"> <!-- change this -->
<!-- -->
</thead>
<tbody>
<!-- -->
</tbody>
</table>
And if you need Bootstrap 4, check out this blog tutorial for an installation guide Angular 10 with Bootstrap 4