P粉3331862852023-09-05 13:58:16
Add bootstrap attributes to button:
<button class="btn btn-primary btn-sm" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation" > Abrir </button>
Link code: https://stackblitz.com/edit/angular-bootstrap-5-dynamic-navbar-77sj13?file=app/app.component.html
It will work, however. Keep in mind that your angular application should control these elements, so mixing external libraries with framework libraries (Angular, Vue, React) will always cause trouble
For this purpose, there are special implementations, for example: https://ng- bootstrap.github.io/#/home Angle guide
Another option is to use ngIf to show the navigation bar (no animation by default)
Another link: https://stackblitz.com/edit/angular-bootstrap-5-dynamic-navbar-hygpzq?file=app/app.component.html