when i remove an dom element all effect still exist in kendo, and kendo try to get injector of those removed elements that i removed.
how can i destroy them to stop kendo for get the injector of them.
the function of kendo is setupRebind
and here is my code:
function
removeAllChildren(level) {
if
(vm.dataLevel.length > vm.currentSender + 1) {
for
(
var
i = vm.dataLevel.length - 1; i > vm.currentSender; i--) {
var
idToRemove =
"#level"
+ i +
""
;
var
idCss =
"#data-level-"
+ i +
""
;
var
selectedData = angular.element(idCss).data(
"kendoDropDownList"
);
kendo.unbind(angular.element(idCss));
kendo.unbind(angular.element(idToRemove));
selectedData.destroy();
angular.element(document.querySelector(idToRemove)).remove();
}
vm.dataLevel.splice(vm.currentSender + 1);
vm.currentElement =
"#level"
+ vm.currentSender +
""
;
}
}
but after this, i traced and i saw that my idToRemove elements still exist in kendo and kendo want to access them via this line
var
compile = element.injector().get(
'$compile'
);
widget._destroy();
my app works very good but i have error for every removed element.
Error:
TypeError: Cannot read property
'get'
of undefined
at http:
//localhost:46255/Scripts/kendo.all.js:118139:53
at Scope.$digest (http:
//localhost:46255/scripts/angular.js:17073:23)
at http:
//localhost:46255/scripts/angular.js:17268:26
at completeOutstandingRequest (http:
//localhost:46255/scripts/angular.js:5869:10)
at http:
//localhost:46255/scripts/angular.js:6145:7
please help me :(