ngx-bootstrap icon indicating copy to clipboard operation
ngx-bootstrap copied to clipboard

Dropdown menu not being rendered on init

Open onepoordeveloper opened this issue 5 years ago • 5 comments

I'm not able to get routerLink activated on the dropdown on init. It works after I trigger the dropdown by clicking on it once and keeps working even after I close it.

It isn't working on init because the dropdown DOM is not rendered by that point. It gets rendered after the dropdown button is clicked.

I want the dropdown list rendered and hidden on init please.

StackBlitz that reproduces the issue:

https://stackblitz.com/edit/ngx-bootstrap-dropdown

This is the default stackblitz for ngx-bootstrap-dropdown.

If DOM is observed, on init, the dropdown elements are not rendered but after it is opened and closed, the elements are there.

onepoordeveloper avatar Sep 18 '19 07:09 onepoordeveloper

Same issue here. Currently didn't even come up with a solution. I need this for SSR.

6matko avatar Oct 16 '19 08:10 6matko

Same here

deache avatar Nov 29 '19 16:11 deache

@AhmadHassanAwan @6matko @deache

I don't know if you came up with a solution, but calling whatever method you need wrapped in a setTimeout() seems to do the trick for me.

I needed to focus on a search field inside the dropdown, and without giving a number it triggers immediately.

gaspaonrocks avatar Jan 16 '20 14:01 gaspaonrocks

When i click the first time on my dropdown, my menu is taking some times to show completely (I have icons inside). But once i opened it once, it works fine because the code is now present in the DOM. But i found a solution but i'm not sure it's a good idea.

How to force the prerender of the menu ? Remove the *dropdownMenu from the ul tag

GaetanRouzies avatar Feb 13 '20 16:02 GaetanRouzies

im having the same issue, is this the best solution? @GaetanRouzies btw, it is not working on mobile when i have submenu

yoniP68 avatar Feb 02 '22 11:02 yoniP68