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.Alternatively you could just remove all of the charts in 'chartDivs' by doing: