angular.module('myApp',[]). controller("listController", ["$scope", function($scope) { $scope.patients = [ {name: "Jean Dupont"}, {name: "Pierre Merti"}, {name: "Jacques Egard"}, {name: "Philippe Petit"}, {name: "Albert Partin"} ]; $scope.patient; $scope.addPatient = function() { $scope.patients.push({name: $scope.patient}); $scope.patient = null; }; $scope.removePatient = function(i) { $scope.patients.splice(i,1); }; }]);
<div ng-controller="listController"> <ul> <li ng-repeat="p in patients">{{p.name}} <button ng-click="removePatient($index)">remove</button></li> </ul> <input type="text" ng-model="patient"><button ng-click="addPatient()">add</button> </div>