ngx-bootstrap: Dropdown not working
Hello, I’m trying to make a standard navbar works (https://getbootstrap.com/components/#navbar) I have installed bootstrap-ngx with angular-cli.
my app.module.ts
import { AlertModule } from 'ngx-bootstrap'; import { CollapseModule } from 'ngx-bootstrap'; import { BsDropdownModule } from 'ngx-bootstrap'; ... imports: [ AlertModule.forRoot(), CollapseModule.forRoot(), BsDropdownModule.forRoot() ],
Still, dropdown not showing, and no error in console… what am I missing ?
Thank you !
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 17 (3 by maintainers)
This worked for me using a navbar.
Mine was not working due to bootstrap3 vs bootstrap4 confusion. When using bootstrap4, definitely verify all the steps shown here: https://github.com/valor-software/ngx-bootstrap/blob/development/docs/getting-started/bootstrap4.md When these steps are not completed, ngx-bootstrap will not properly change the classes of the btn-group. Bootstrap4 needs to see a “show” class added, but ngx-bootstrap was only adding an “open” class. After applying all the bootstrap4 steps it’s working. Both classes are added: “open show”
Hi, i confirm the dropdown doesn’t works with “a” tag, but works well with button. regards
Have you tried adding the code from demo to your template? I just don’t see any actual initialization of dropdown in the piece of code you’ve provided Try to add the following code to your template
This code works, I have tried with all the examples in the official ngx bootstrap and no one works, so thanks @joeangry for your help.
I tried changing the version of ngx Bootstrap to 4.0.1 and it worked for me Command I executed : npm install ngx-bootstrap@4.0.1 --save