Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用IE在角度模板中设置HTML样式的问题_Javascript_Html_Css_Angularjs_Internet Explorer - Fatal编程技术网

Javascript 使用IE在角度模板中设置HTML样式的问题

Javascript 使用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

在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);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)'}"