gpt4 book ai didi

angular - ng-bootstrap ngbDropdown 无法正常工作 Angular 4

转载 作者:太空狗 更新时间:2023-10-29 17:02:29 29 4
gpt4 key购买 nike

ng 下拉菜单不起作用。

注:我按照答案here并将 Bootstrap 升级到 4-alpha,但它不工作。

下面是我的 package.json 文件:

    "@angular/animations": "^4.3.0",
"@angular/common": "^4.3.0",
"@angular/compiler": "^4.3.0",
"@angular/core": "^4.3.0",
"@angular/forms": "^4.3.0",
"@angular/http": "^4.3.0",
"@angular/platform-browser": "^4.3.0",
"@angular/platform-browser-dynamic": "^4.3.0",
"@angular/router": "^4.3.0",
"@angular/upgrade": "^4.3.0",
"@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.28",
"@types/jquery": "^3.2.8",
"angular-calendar": "^0.19.0",
"angular2-ladda": "^1.2.1",
"angular2-text-mask": "^8.0.2",
"angular2-toaster": "^4.0.1",
"animate.css": "^3.5.2",
"bootstrap": "4.0.0-alpha.6"

html代码:

<div ngbDropdown class="d-inline-block">
<button class="btn btn-outline-primary nav-link dropdown-toggle" id="dropdownBasic1" ngbDropdownToggle>More Actions..</button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownBasic1">
<button class="dropdown-item">Action - 1</button>
<button class="dropdown-item">Another Action</button>
<button class="dropdown-item">Something else is here</button>
</div>
</div>

在我的 app.module.ts 中也导入了 ngbModule。

import {NgbModule} from "@ng-bootstrap/ng-bootstrap";

@NgModule({
imports: [
BrowserModule,
FormsModule,
ReactiveFormsModule,
NgbModule.forRoot()
//more
]

Bootstrap 按钮和文本输入有效,所有样式均已应用,但下拉菜单在点击时无效。

enter image description here

非常感谢任何输入。

最佳答案

NgbModule 也必须在单独的模块中导入。学分:有太空服

关于angular - ng-bootstrap ngbDropdown 无法正常工作 Angular 4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45146485/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com