angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

Possible bug with attributes not refreshing in IE11

Open iorzetic opened this issue 12 years ago • 6 comments

Scenario: I need to calculate a value for a style property and bind it in the view to auto-update whenever the value changes. When I try to do this in IE11 (not sure about other versions of IE - didn't test) it does not update the attribute, althoug when I display that value somewhere else it works as expected. On other browsers like Chrome and Firefox this works fine.

The fix I am forced to apply here is to use the ng-style directive, but I would rather avoid that for performance reasons.

Example on plunkr - should also increase the height of the container in IE11 like on other browsers: http://plnkr.co/edit/ClDZPBZxzhncY0RXZbqr?p=preview

iorzetic avatar Apr 25 '14 09:04 iorzetic

Yes, this is one of the "IE things...". The ngStyle directive is here to remedy the problem: https://docs.angularjs.org/api/ng/directive/ngStyle

pkozlowski-opensource avatar Apr 25 '14 09:04 pkozlowski-opensource

Hey @pkozlowski-opensource ,

Long time no see :)

I might be wrong, but ng-style is wrapped in a $apply cycle, which is pretty costly (https://github.com/angular/angular.js/blob/master/src/ng/rootScope.js#L952). Why trigger another $digest, if the first one should do the job?

Please mind we are speaking about IE11, not IE8.

Have a wonderful week!

Kind regards, Dragos

dragosrusu avatar Apr 27 '14 23:04 dragosrusu

I'm going to close this since @petebacondarwin addressed the original poster's issue.

@dragosrusu if you want to open another issue to discuss the performance of this, that'd be fine. It might help to start with a benchmark or example of why this is prohibitively slow. Thanks!

btford avatar May 21 '14 22:05 btford

I think it was @pkozlowski-opensource who dealt with the issue

petebacondarwin avatar May 22 '14 05:05 petebacondarwin

So nobody solved this eventually? I'm not speaking about the perf. issue, but the initial IE11 issue.

dragosrususv avatar May 23 '14 18:05 dragosrususv

@dragosrusu - yes, the solution is to use ngStyle.

petebacondarwin avatar May 27 '14 21:05 petebacondarwin