Angularjs remove()方法是不工作的IE11 [英] Angularjs remove() method is not working on IE11
问题描述
以下Angularjs remove()方法是在Firefox工作的罚款。然而,当我使用Internet Explorer 11(IE 11),它不工作。我收到错误,对象不支持属性或方法删除
以下是我的code。任何帮助,请。你甚至可以参考plunker http://plnkr.co/edit/0XtT0f?p= preVIEW ,当您使用IE11删除图表将无法正常工作。我使用angulajs 1.2.16。
VAR chartDivs = angular.element(document.querySelector('。chartsDiv'))
VAR cntChartDivs = chartDivs.length;如果(cntChartDivs){
而(cntChartDivs大于0){
chartDivs [cntChartDivs - 1]一个.remove();
cntChartDivs = cntChartDivs - 1;
}
}
做 chartDivs [cntChartDivs - 1]
返回原始DOM元素。在remove()函数是在JQlite包装,所以你只需要重新包起来。
angular.element(chartDivs [cntChartDivs - 1])删除();
另外,你可以只用做删除所有的'chartDivs排行榜:
chartDivs.remove();
The following Angularjs remove() method is working fine in firefox. However when I use Internet Explorer 11 (IE 11), it is not working. I am getting the error, Object doesn't support property or method 'remove'
The following is my code. Any help please. You can even refer the plunker http://plnkr.co/edit/0XtT0f?p=preview, when you use IE11 'Remove Chart' won't function. I am using angulajs 1.2.16.
var chartDivs = angular.element(document.querySelector('.chartsDiv'))
var cntChartDivs = chartDivs.length;
if (cntChartDivs) {
while (cntChartDivs > 0) {
chartDivs[cntChartDivs - 1].remove();
cntChartDivs = cntChartDivs - 1;
}
}
Doing chartDivs[cntChartDivs - 1]
returns the raw DOM element. the remove() function is on the JQlite wrapper, so you just need to rewrap it.
angular.element(chartDivs[cntChartDivs - 1]).remove();
Alternatively you could just remove all of the charts in 'chartDivs' by doing:
chartDivs.remove();
这篇关于Angularjs remove()方法是不工作的IE11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!