Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding ngbNavLink cause all subsequent elements to be invisible #4684

Open
Arnaud-Nauwynck opened this issue Mar 17, 2024 · 1 comment
Open

Comments

@Arnaud-Nauwynck
Copy link

Arnaud-Nauwynck commented Mar 17, 2024

Bug description:

after a ngbNavLink, all elements are invisible: their text content are empty.
For example

 <a ngbNavLink>SomeText</a>   
becomes 
<a></a>

Notice that in stackblitz, this is even worse, all elements are removed, not only element after the directive (?)

example code:

<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <ul ngbNav class="navbar-nav mr-auto">
    <li ngbNavItem>
      <a class="nav-link" routerLink="/">Item1</a>
    </li>
    <li ngbNavItem>
      <a class="nav-link" routerLink="/">Item2</a>
    </li>
    <li ngbNavItem >
      <a ngbNavLink class="nav-link" routerLink="/">Item3</a>  <!-- ngbNavLink here ... so Item3 and Item4 are not visible (but Item1 +Item2 are OK) -->
    </li>
    <li ngbNavItem>
      <a class="nav-link" routerLink="/">Item4</a>
    </li>
  </ul>
</nav>

Link to minimally-working StackBlitz that reproduces the issue:

https://ng-bootstrap-bug-ngbnavlink-3wbhwp.stackblitz.io/

Versions of Angular, ng-bootstrap and Bootstrap:

Angular: 17.0.9

ng-bootstrap: 16.0.0

Bootstrap:

@Arnaud-Nauwynck Arnaud-Nauwynck changed the title adding ngbNavLink adding ngbNavLink cause all subsequent elements to be invisible Mar 17, 2024
@jnizet
Copy link
Member

jnizet commented Mar 18, 2024

The problem comes from the fact that you're using the routerLink directive without having provided the router (with provideRouter([]) when bootstrapping the application. Open the browser console, and you'll see the error causing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants