You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Hi,
migrating from bindonce to the new one-time bindings, I cannot do something like: ng-style="::{color : colorVar}" where colorVar is not initially set.
In this plunker, setting colorVar is delayed by 1500 ms, and the one time binding does not apply the change. It works for name, though.
Reading the code, it looks like this is because the one time wrapper for $parse checks if the whole expression is undefined, so the ng-style expression is intially defined as {'background-color': undefined}, which is 'good enough' for one time bind. The workaround that comes to mind is putting the whole ng-style expression in a variable and set that after the timeout. (see plunker) However, that is more verbose and you lose the "expressiveness" of the template.
Is this expected use, or can this be changed in the future? It sure is confusing at least!