ng-bootstrap ngbDropdown not working Angular 4

后端 未结 3 1583
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-19 06:10

ng dropdowns are not working.

Note: I followed the answer here and upgraded bootstrap to 4-alpha, yet it\'s not working.

Below is my package.json file:

相关标签:
3条回答
  • 2021-02-19 07:01

    add ngb modules you use, NgbModule has to be imported....

    @NgModule({
      imports: [
            ..,
            NgbModule.forRoot()
       ],
      ...
    
    0 讨论(0)
  • 2021-02-19 07:03

    @Maddy Just make some minor change to your html code:

    <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" ngbDropdownMenu >
                        <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>
    

    ngbDropdownMenu is property added to "dropdown-menu" div.

    0 讨论(0)
  • 2021-02-19 07:12

    NgbModule has to be imported within the separate module as well. Credits: HaveSpacesuit

    0 讨论(0)
提交回复
热议问题