title: How to call a scope function from another one angularjs?
body: <p>I have a table filled with data;
  I have a button to delete a row,
  and I have input fields that show data from the selected row from table.</p>
  
  <p>First I have to select that row...then the input fields <code>r</code> filled with the data from that same row....once I've done it, I can press delete...and the row is deleted...and the row below that deleted row is now selected...(which I can change not to be)...but the old values from the deleted row are still in the input fields...</p>
  
  <p>Now I have to do something...2 options:</p>
  
  <ol>
  <li><p>set the selected row to null, and clear all the input fields...(which I have no idea how to do it...)</p></li>
  <li><p>use the new selected row and fill its data into the input fields...witch is in my opinion the better way to go...</p></li>
  </ol>
  
  <p>So please help me, here is the code:</p>
  
  <p>In my html file I have this:</p>
  
  <pre><code>&lt;p&gt;ID&lt;/p&gt;
  &lt;input ng-model="student.id"&gt;
  &lt;p&gt;Name&lt;/p&gt;
  &lt;input ng-model="student.firstname"&gt;
  &lt;p&gt;Last Name&lt;/p&gt;
  &lt;input ng-model="student.lastname"&gt;
  
  &lt;button ng-click="deleteStudent(student)"&gt;Delete Student&lt;/button&gt;
  
  
      &lt;table name="tableStud" arrow-selector&gt;
          &lt;tbody&gt;
              &lt;tr&gt;
  
                  &lt;td&gt;ID&lt;/td&gt;
                  &lt;td&gt;First Name&lt;/td&gt;
                  &lt;td&gt;Last Name&lt;/td&gt;
                  &lt;td&gt;From&lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr ng-repeat="student in result"
                  ng-class="{'selected':$index == selectedRow}"
                  ng-click="setSelected(student,$index)"&gt;
                  &lt;td&gt;{{ student.id }}&lt;/td&gt;
                  &lt;td&gt;{{ student.firstname }}&lt;/td&gt;
                  &lt;td&gt;{{ student.lastname }}&lt;/td&gt;
                  &lt;td&gt;{{ student.mestorodjenja.ime }}&lt;/td&gt;
  
              &lt;/tr&gt;
  
          &lt;/tbody&gt;
      &lt;/table&gt;
  </code></pre>
  
  <p>I have a controler....with this:</p>
  
  <pre><code>$scope.deleteStudent = function(student) {
      $http.post('http://localhost:8080/CreditCardWEB/rest/cc/delete',
              student).success(function(data) {
          $scope.result.splice($scope.selectedRow, 1);
  
      });
  
  };
  
  $scope.selectedRow = null;
  
  $scope.setSelected = function(student, index) {
      $scope.student = student;   
      $scope.selectedRow = index;
  };
  </code></pre>