I wrote s small bit of code that adds names to an array. The problem I am getting is that if I try add the same name more than once it will not allow me. It also will not allow me any other name after trying to add a duplicate name. Here is my Angular code
app.controller('DirectoryController', function($scope){
$scope.name='';
$scope.names= [];
$scope.addName = function(){
$scope.names.push($scope.name);
}
});
And here is my html
<div ng-controller= "DirectoryController">
<h3>Name:</h3><input type="text" ng-model='name'>
<button ng-click = "addName()">Save</button>
<hr/>
<span ng-repeat="name in names">{{name}}<br/></span>
</div>