ngSticky
ngSticky copied to clipboard
initialCSS not getting correct values
I'm using ngSticky for two elements. For one of the two element the initialCSS values are not correct. It seems as if the element, which is loaded through a template file via the ui router plugin, is not ready yet when the ngSticky directive is run. When I wrap the initialCSS object in a setTimeout function and return it, this problem doesn't occur.
This feels a bit hacky though. Do you have any suggestions on how to fix this issue properly?
It seems as if I figured it out with the help of this article http://buzzdecafe.github.io/2014/03/20/directive-after-dom/.
The element wasn't loaded yet in the DOM apparently, the solution is to wrap the entire content of the link function in a $timeout function with a delay of 100ms.
Any better solutions would still be appreciated!
I saw the same thing. As far as I know, your solution of wrapping in a $timeout would be the best fix.