这是我的朋克, https://plnkr.co/edit/stKf1C5UnCKSbMp1Tyne?p=preview
angular.module('listExample',[])
.controller('ExampleController',['$scope',function($scope) {
$scope.names = ['morpheus','neo','trinity'];
}]);
<body ng-app="listExample">
<form name="myForm" ng-controller="ExampleController">
<label>List: <input name="namesInput" ng-model="names" required></label>
<br>
<tt>names = {{names}}</tt><br/>
</form>
</body>
$scope.names
是一个数组,当用于显示在html的输入字段中时,它显示为morpheus,neo,trinity
但是如何在html输入字段
["morpheus","neo","trinity"]
然后在输入字段中从数组中添加或删除元素时,用新值更新$ scope.names