Bootstrap 4.1.1 Navbar not working with Angular 6

前端 未结 4 504
鱼传尺愫
鱼传尺愫 2021-01-13 03:05

I have been trying to work on Navbar with collapse menu and dropdown link using Bootstrap 4.1.1 and Angular 6 but somehow Navbar is not working at all. I can see elements co

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-13 03:49

    I have lost 2 hours chasing ghosts. Notice that there is two scripts segment in angular.json. One under test and one under build. You should add under build segment. I was adding under test so angular didn't see bootstrap, and popper js

    "architect": {
            "build": {
              "builder": "@angular-devkit/build-angular:browser",
              "options": {
                "outputPath": "dist/myBootstrapTestApp",
                "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.scss"
                ],
                "scripts": [
                  "node_modules/jquery/dist/jquery.js",
                  "node_modules/popper.js/dist/umd/popper.min.js",
                  "node_modules/bootstrap/dist/js/bootstrap.js"]
              },
    

提交回复
热议问题