Angular JS ng-style and Internet Explorer 8

无人久伴 提交于 2019-12-13 13:24:23

问题


I have a problem I can't seem to understand.

In IE8 the directive ng-style doesn't seem to work at all. I'm using it to set the width of an element. On all other browsers it works fine.

On IE8, inspecting the element with the crappy F12 tool, the style property is entirely missing.

Anyone can tell me if there's a workaround? The angularjs version I'm using is the stable version at the time of writing (1.0.2)

Thanks


回答1:


Ok I found why {{ }} wasn't working in IE7: you have to polyfill JSON.stringify because it's used to display objects and IE7 don't have it, if you display a string it's working:

http://jsfiddle.net/NLrYx/3/

More info on IE7 compat: http://docs.angularjs.org/guide/ie

JSON script: https://github.com/douglascrockford/JSON-js/blob/master/json2.js



来源:https://stackoverflow.com/questions/12642188/angular-js-ng-style-and-internet-explorer-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!