arkon / ng-sidebar

[Inactive] Angular sidebar component.

Home Page:https://echeung.me/ng-sidebar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ng sidebar not hiding initially if opened set to false

jomol-aima opened this issue · comments

Hi,

I am experiencing this issue again. In my case, I have lazy loaded the module. I have a header component with toggle button, and a sidebar component. Included the header and sidebar component to the dashboard via component selector. Whenever I reload the page, the sidebar is initially showing and then hiding. If I check toggle state outside of the sidebar, then it working fine, but that time animation not work. I couldn't find the issue. Can you help me?

@jomol-aima Problem is with the [animate]="true". Either you can remove it or this workaround would work.

  animate = false;

  ngOnInit() {
    setTimeout(() => {
      this.animate = true;
    });
  }