arkon / ng-sidebar

[Inactive] Angular sidebar component.
https://echeung.me/ng-sidebar
MIT License
388 stars 136 forks source link

"Expression Has Changed" error when autoCollapseWidth is set and [(opened)] is true #204

Closed joekaiser closed 4 years ago

joekaiser commented 4 years ago

Create a sidebar and set [(opened)]="sidebarOpen" autoCollapseWidth="860". If the page loads when sidebarOpen = true and and the browser width is <860, then angular throws a "Expression has changed after it was checked" error. If the browser width is >860 then the error goes away.

Obviously, this is because opened is clashing with the auto collapse feature. Is there a known workaround for this? What I am looking to do is to have the sidebar shown by default, but if the page loads and the width is too small then it should be collapsed.

I have created a simple reproduction here https://codesandbox.io/s/ng-sidebar-error-pvr4e

Check the console for the error

joekaiser commented 4 years ago

@arkon I saw your comment here. https://github.com/arkon/ng-sidebar/issues/203#issuecomment-628320357 Is this repo still supported?

arkon commented 4 years ago

Is this repo still supported?

Barely. :)

I pushed out something that might help.

joekaiser commented 4 years ago

Thanks for the effort, but the bug still exists. See https://codesandbox.io/s/ng-sidebar-error-pvr4e for a demo.

Maybe i'll take a shot and do a PR