2
以下Angularjs remove()方法在Firefox中正常工作。但是,當我使用Internet Explorer 11(IE 11)時,它不起作用。我收到錯誤,對象不支持屬性或方法'刪除'Angularjs remove()方法在IE11上不工作
以下是我的代碼。請任何幫助。您甚至可以參考猛擊http://plnkr.co/edit/0XtT0f?p=preview,當您使用IE11'刪除圖表'將不起作用。我正在使用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;
}
}
在一個側面說明遍歷'chartDivs'是沒有意義的'document.querySelector'只返回遇到的第一個元素 – Enzey 2014-12-05 06:14:21