<!doctype html>
<html ng-app>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.20/angular.min.js"></script>
  </head>
  <body>
    <div ng-controller='StudentListController'>
      <ul>
        <li ng-repeat='student in students'>
          <a ng-href='/student/view/{{student.id}}'>{{student.name}}</a>
        </li>
      </ul>
      <button ng-click="insertTom()">Wstaw Tomasza</button>
    </div>
    <script>
      var students = [{name:'Maria Nowak', id:'1'},
        {name:'Jacek Kowalski', id:'2'},
        {name:'Jan Malinowski', id:'3'}];

      function StudentListController($scope) {
        $scope.students = students;

        $scope.insertTom = function () {
          $scope.students.splice(1, 0, {name:'Tomasz Tomaszewski', id:'4'});
        };
      }
    </script>
  </body>
</html>
