Javascript 使用IE在角度模板中设置HTML样式的问题
在Internet Explorer中重复数据数组时,我无法设置元素的样式。在Safari、Chrome、Firefox中,一切都很好,但出于某种原因,IE不喜欢我做事的方式 我使用了一个自定义的过滤器,您将在下面看到ng repeatJavascript 使用IE在角度模板中设置HTML样式的问题,javascript,html,css,angularjs,internet-explorer,Javascript,Html,Css,Angularjs,Internet Explorer,在Internet Explorer中重复数据数组时,我无法设置元素的样式。在Safari、Chrome、Firefox中,一切都很好,但出于某种原因,IE不喜欢我做事的方式 我使用了一个自定义的过滤器,您将在下面看到ng repeat .filter('range', function() {return function(input, total) {total = parseInt(total);for (var i=0; i<total; i++)input.push(i);ret
.filter('range', function() {return function(input, total) {total = parseInt(total);for (var i=0; i<total; i++)input.push(i);return input; };})
您的问题可能是由于用于设置宽度和高度的字符串语法造成的。相反,请尝试使用对象文字语法,即
{width:widthProp,height:heightProp}
i、 e
及
谢谢谢谢谢谢谢谢!!!!!这很好用。我明白我做错了什么;我感谢你的解释。
<div ng-repeat="key in [] | range:documentData.info.pages">
<div ng-if="(key+1) <= documentData.info.pages" ng-style="width:{{ documentData.style.width }}px;height:{{ documentData.style.height }}">
<div class="formBackground" ng-style="background-image:url('/images/templates/{{ documentData.info.uid }}/{{ documentData.info.id }}/{{ (key+1) }}.png')">
Stuff
</div>
</div>
</div>
ng-style="{width:documentData.style.width, height: documentData.style.height }"
ng-style="{'background-image':'url(/images/templates/{{documentData.info.uid}}/{{documentData.info.id}}/{{(key+1)}}.png)'}"