Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 引导式手风琴在角度5时不工作?_Angular_Twitter Bootstrap - Fatal编程技术网

Angular 引导式手风琴在角度5时不工作?

Angular 引导式手风琴在角度5时不工作?,angular,twitter-bootstrap,Angular,Twitter Bootstrap,嗨,我在Angular 5开发web应用程序。我正在努力发展手风琴,我正在跟随。我使用Angular cli创建了Angular 5应用程序。之后,通过npm安装引导和Jquery。我从codepen复制了相同的代码。下面是我的angular.json文件,其中包含指向引导和jquery的链接 { "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "version": 1, "newProjectRoo

嗨,我在Angular 5开发web应用程序。我正在努力发展手风琴,我正在跟随。我使用Angular cli创建了Angular 5应用程序。之后,通过npm安装引导和Jquery。我从codepen复制了相同的代码。下面是我的angular.json文件,其中包含指向引导和jquery的链接

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

            ]
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "JsonTree:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "JsonTree:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "JsonTree:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "karmaConfig": "src/karma.conf.js",
            "styles": [
              "src/styles.css"
            ],
            "scripts": [],
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "JsonTree-e2e": {
      "root": "e2e/",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "e2e/protractor.conf.js",
            "devServerTarget": "JsonTree:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "JsonTree:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": "e2e/tsconfig.e2e.json",
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "JsonTree"
}
每当我运行代码时,所有内容都显示为纯文本,如下图所示。我可以知道不应用引导样式的原因吗?有人能帮我吗?任何帮助都将不胜感激。谢谢。

angular.json配置中缺少引导css文件

尝试在脚本属性级别添加
style
属性:

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

您没有将bootstrap导入项目hi,我已经在angular、json文件中添加了“/node_modules/jquery/dist/jquery.min.js”,“/node_modules/bootstrap/js/bootstrap.min.js”,“/node_modules/bootstrap/dist/css/bootstrap.min.css”,您是否收到任何控制台错误?是未捕获的语法错误:意外标记{在script.js文件中谢谢。我应该在哪里添加该文件?我可以在两个位置看到styles标记。一个内部测试和一个内部项目应该在项目下,就像您处理js文件一样:)