title: Uncaught TypeError: Cannot read property 'attributes' of undefined
body: <p>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.</p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'attributes' of undefined
  at _clearTreeSelection (orphanController.js:888)
  at Scope.$scope.clearSelection (orphanController.js:659)
  at HTMLDivElement.&lt;anonymous&gt; (orphanController.js:1058)
  </code></pre>
  
  <p>at line number 888 this is my code:</p>
  
  <pre><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 &amp;&amp; $scope.OntologyTree.currentNode) {
          $scope.OntologyTree.currentNode = null;
      }
  };
  </code></pre>
  
  <p>at line number 659 this is my code:</p>
  
  <pre><code>$scope.clearSelection = function () {
      _clearTreeSelection();//line no.659
      _clearGazetteerSelection();
  };
  </code></pre>
  
  <p>at line number 1058 this is my code:</p>
  
  <pre><code>_modal.on('hidden.bs.modal', function () {
      $scope.suggestionListSearchText = '';
          $scope.clearSelection();// line no. 1058
      });
  }
  </code></pre>
  
  <p>I have checked all over stackoverflow, i cant find the suitable solution for this problem.</p>