我是Angular的新手,在使用Bootstrap切换和Modal时遇到了一些问题。BootStrap CSS文件之所以能正常工作,是因为表单采用了样式;但是,我认为JS文件没有正确链接。请让我知道我在做什么工作。
我使用Angular CLI对BootStrap和jQuery进行了NPM安装。安装后,我将BootStrap和jQuery文件链接到angular.json文件,以便应用程序能够使用库。
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/LyndaChapter1",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
**"styles": [
**"node_modules/bootstrap/dist/css/bootstrap.css",
"src/styles.css"**
],
"scripts": [
"node_modules/bootstrap/dist/js/bootstrap.js",
"node_modules/jquery/dist/jquery.js"
],**
"es5BrowserSupport": true
},
"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,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
}
}
},
预期结果:切换和模态应该起作用实际结果:两者都不起作用
发布于 2019-05-30 13:15:05
尝试将这些包添加到您的package.json文件中,并在Package.json文件级运行npm install --save命令。
/* "@ng-bootstrap/ng-bootstrap":"^4.1.0","bootstrap":"^4.3.1“*/
https://stackoverflow.com/questions/56371627
复制相似问题