Include Bootstrap

  • Step

    Bootstrap

    1. Install bootstrap
    
                 npm install bootstrap
    

    bootstrap folders will be installed in node_modules folder

    bootstrap package version will be added to the file package.json

    2. add the css and js file to angular.json

    1. open angular.json

    2. add css file to the parameter 'styles'

    3. add js files to the parameter 'scripts'

    
    { 
         "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 
          "version": 1, 
            "newProjectRoot": "projects", 
             "projects": {    "angular-bootstrap-examples": {      "projectType": "application",      "schematics": {},      "root": "",      "sourceRoot": "src",      "prefix": "app",      "architect": {        "build": {          "builder": "@angular-devkit/build-angular:browser",          "options": {            "outputPath": "dist/angular-bootstrap-examples",            "index": "src/index.html",            "main": "src/main.ts",            "polyfills": "src/polyfills.ts",            "tsConfig": "tsconfig.app.json",            "aot": true,        
                  "assets": [              "src/favicon.ico",              "src/assets"            ],     
                         "styles": [              "./node_modules/bootstrap/dist/css/bootstrap.css",              "src/styles.css"                          ],     
                                "scripts": [              "./node_modules/jquery/dist/jquery.js",              "./node_modules/bootstrap/dist/js/bootstrap.js"            ]          },
    

    2. Other libraries

    Toster
    
    npm install ngx-toastr --save
             

    add in angular.json

    
             "styles": [  
               "./node_modules/bootstrap/dist/css/bootstrap.css",    
                       "src/styles.css"   
                       "./node_modules/ngx-toastr/toastr.css",
                       ],