Hello everyone i am trying to perform delete operation in my web app,when i am deleting an element from DB, in console its showing this error.Please give your valuable solution for this Thanks in advance.
Uncaught TypeError: Cannot read property 'attributes' of undefined
at _clearTreeSelection (orphanController.js:888)
at Scope.$scope.clearSelection (orphanController.js:659)
at HTMLDivElement.<anonymous> (orphanController.js:1058)
at line number 888 this is my code:
//This is to clear the selectedNode of angular tree on modal close
_clearTreeSelection = function () {
$scope.orphanData.orphanText =
$scope.orphanData.orphan.attributes.text;//This is line no.888
if ($scope.OntologyTree && $scope.OntologyTree.currentNode) {
$scope.OntologyTree.currentNode = null;
}
};
at line number 659 this is my code:
$scope.clearSelection = function () {
_clearTreeSelection();//line no.659
_clearGazetteerSelection();
};
at line number 1058 this is my code:
_modal.on('hidden.bs.modal', function () {
$scope.suggestionListSearchText = '';
$scope.clearSelection();// line no. 1058
});
}
I have checked all over stackoverflow, i cant find the suitable solution for this problem.
This means that your
$scope.orphanData.orphan
isundefined
. Find where have you declared this object and be sure that it refers to an object.