Reputation: 2805
I'm having problems trying to load bootstrap on Angular 6, I already installed bootstrap (npm install bootstrap
) and declared it on angular.json but still doesn't work. Is there any other thing I should do? Im also using sass, does that interfere in something?
Here's the angular.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"test-itau": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"@schematics/angular:component": {
"styleext": "scss"
}
},
"targets": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/test-itau",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css",
"./node_modules/bootstrap/dist/css/bootstrap.min.css"
],
"scripts": []
},
//more code...
Upvotes: 1
Views: 368
Reputation: 1399
While I'm not sure why that doesn't work, there's a few things that you can do to get bootstrap themes on your site.
If you wanted to use a CDN, you could add a link
element to the head of your index.html
file.
Alternatively, if you could do it how Angular material does, and import it from your src/styles.scss
file. Like so:
@import '~bootstrap/dist/css/bootstrap.min.css';
Edit: Here's an example of it working
Upvotes: 1