let's have array so:
$scope.items = [ {'name': '1'}, {'name': '2'}, {'name': '3'}, ]; then have in template:
<div ng-repeat="x in items"> <input ng-model="x.name" /> </div> does have ideas on how go not allowing duplicate names? example, if typed in 3rd input box number 1, wouldn't allow it.
use ngblur call following function in controller , pass x it
var validatename = function (xfromview) { if (items.map(function (x) { return x.name }).indexof(xfromview.name) > -1) { xfromview.name = null; //let user know somehow input invalid } }
Comments
Post a Comment