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
NgbNav wont work with dynamic tabs loaded from Http-Request #3920
Comments
Hi. I don't have a fix, but I have a workaround, that is probably cleaner anyway: only dsplay all the nav markup once you have the data needed to display them: https://stackblitz.com/edit/angular-57365j-bbfgdu?file=src%2Fapp%2Fnav-basic.html
|
@jnizet thanks, that looks great. i just wanted to test it when i call a syncronous request instead of async. but this looks very good. many thanks and merry christmas. |
If you don't mind, I will reopen this, because I think there's an issue here, and your original code should work (even though I would still use my version) |
It doesn't work with 7.0.0 either → https://stackblitz.com/edit/angular-57365j-mbvbrz |
Ok, this was fixed by #3909 in When you render Ex. you remove programmatically the nav that is currently active. What should we do? Select the first one? Previous one? next one? We've decided to do nothing. See this demo for the illustration In your example even with the rendering bug fixed in this.dynamicTabs = this.http.get(this.url).pipe(tap(tabs => {
this.active2 = tabs[2].id;
})); This also explains how the workaround by @jnizet works. And frankly I'd probably use his workaround for UX reasons and show something like |
Fixed by #3909 |
Bug description:
I want to use ngbNav to generate a dynamic Navigation. The Tabs renders fine, but the Content was never showed.
I forked the basic-example and create one example with dynamic tabs that is working, but with initialised array of tabs and one with an api-call:
https://stackblitz.com/edit/angular-57365j?
Angular: 10.0.14
ng-bootstrap: 8.0.0
The text was updated successfully, but these errors were encountered: