AngularJS 样式问题 IE [英] AngularJS style issue IE

查看:27
本文介绍了AngularJS 样式问题 IE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试弄清楚如何在 IE 上进行这项工作:

Im trying to figure out how to make this work on IE:

<div ng-if="result.is_mesurable==true" style="left:{{ (result.user_score * 20)-10}}%" class="test-box">

代码基本上是生成一个动态表,从user_score值中取出对象的左边位置.

The code basically generates a dynamic table, and the left position of the object is taken from the user_score value.

我知道 IE 没有正确读取这个声明,我过去也有过类似的错误:

I know that IE doesn't read this declaration properly, i had a similar bug in the past:

AngularJS 奇怪的渲染问题

因为{{xxx.xxx}}是无效的css,所以被IE截断,angular编译器扫描所有属性时,style属性为空."

我知道一定有类似的解决方案,但到目前为止我一直无法弄清楚.

I know there must be a similar solution, but so far i've been unable to figure it out.

提前谢谢.

另外,请注意,在 IE 上的结果是一个空的样式属性.

also, just to note, the result on IE is an empty style attr.

推荐答案

问题是一样的,可以用 ng-style 或 ng-attr-style 解决:

The issue is the same, solvable with ng-style or ng-attr-style:

ng 风格:

<div ng-style="{left: ((result.user_score * 20) - 10) + '%'}" class="test-box" ng-if="result.is_mesurable==true">

ng-attr-*

<div ng-attr-style="left:{{ (result.user_score * 20)-10}}%" class="test-box" ng-if="result.is_mesurable==true" >

这篇关于AngularJS 样式问题 IE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆