-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Can't set css props while using {{}}-expression within style-attribute #12763
Comments
@dhilt you are trying to set element css in two place
and second one in javascript The problem is in the second element because you are setting it's style. i think what happen is that Do you understand ? |
@m-amr But don't you think it is a bug? cause in my demo angular-digest has to deal only with 'visibility' property while .css() deals with 'overflow-y' property; looks like a strange collision; these two settings have to be independent, isn't it? |
I think might be related to/the same as #9109. My speculation from #9109 (comment) (point D) seems valid:
Unfortunately, I can't think of a good solution 😞 |
@gkalpak Your investigation is realy good! but your suggestion
I guess could be a bit irrelevant to situation discussed here. Cause by my demo we can obtain the next sequence:
And the problem is that on (3) we get wrong value, we always get "" (as it was shown by @m-amr). So no modifications to the original template string have been made from (1) to (3), no .css() execution, but on (3) we see wrong data. May be I should change the title cause .css() works properly as I see now... |
I've updated the issue demo: http://jsfiddle.net/dhilt/8tceyw2w/5/. It became simplier.
|
@dhilt, here is what is going on:
BTW, I think that what I proposed as a possible solution in #9109 (comment) won't actually work, but I believe the analysis of the problem is still valid. |
@gkalpak I can't agree with p.4: a) when watchAction is triggered on app start (without manual changing of $scope.visible) I see that overflowX is "" while overflowY is "auto"; it is so when I come into angular $digest() for the first time b) when watchAction is triggered by $scope.visible manual changing (and I come into the body of angular $digest() for the second time) both of them are empty |
@dhilt, it is probably because in your latest example you have a |
@gkalpak got it, thanks) thus we have a contradiction between dom-node attr internal recalculation when we are using {{}}-expression and dom-node attr external modifying (for example .css() style modifying). This problem is buried under a bunch of comments (on my #12763 and your #9109 issues I mean), may be it would be better to open another issue and close this one to increase the probability that somebody will fix it? |
@dhilt, sure, feel free to close this one and open a new "more-to-the-actual-point" issue (with links to comments you think provide useful context). |
Greetings! I've made a little repro: http://jsfiddle.net/dhilt/8tceyw2w/3/ on Angular 1.4.4.
My problem is that I can't set css property via .css() while I'm playing with visibility of the element like this:
And there is no problem when I switch to classes-playing:
So we have two similar situations with two different behaviour. In the demo (http://jsfiddle.net/dhilt/8tceyw2w/3/) I try to set some property syncronous for both cases right after the visibility is switched, and my expectation is that the values of this property of both elements must be the same. And they are not the same.
Please advise!
The text was updated successfully, but these errors were encountered: