将 ngbootstrap 导入 angular 6 个项目中断了项目

Importing ngbootstrap to angular 6 project breaks project

所以,我一直在尝试将 NgBootstrap 添加到我的 angular 6 应用程序中—— 脚步: - 我在 Index.html:

中引用 bootstrap 依赖项
<!doctype html>
<html>
<head>
    <base href="/">
    <meta charset="utf-8">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="pragma" content="no-cache">
    <meta name="robots" content="noindex,nofollow">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link type="image/x-icon" href="favicon.ico" rel="shortcut icon">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script>
    <title>UserInterface</title>
</head>
<body>
    <app-root></app-root>
</body>
</html>

然后:

npm install --save @ng-bootstrap/ng-bootstrap

当我导入 NgbModule

时,我已经了解了我的 App.Module.Ts 中的重大更改这一事实
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { RouterModule } from "@angular/router";
import { AppComponent } from "./app.component";
import { ROUTES } from "./app.routes";
import { LayoutModule } from "./views/layout/layout.module";
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
@NgModule({
    bootstrap: [AppComponent],
    declarations: [AppComponent],
    imports: [
        BrowserModule,
        RouterModule.forRoot(ROUTES),
        LayoutModule,
        NgbModule.forRoot()
]
    })
    export class AppModule { }

有什么明显的问题吗?

我会建议您从 index.html 中删除 css 和 js 文件路径。

我认为没有必要在index.html中添加路径。

我创建了一个示例,你可以看看here

此外,我会向您推荐此 reference 网站以获取更多说明。

如果您是从 Angular 9 开始回答这个问题,请在页面加载 (ctrl-f5) 时查看您的控制台。您可能需要 ng add @angular/localize.