我有一个表格与ngmodel我做一个数组, 我想看ngmodel(数组)以避免输入文本之间的重复 https://docs.oracle.com/cd/E23943_01/web.1111/e13707/identity_trust.htm#SECMG379
这将是一个输入
<md-input-container md-theme="default" class="col-xs-3 col-sm-3 col-md-3 col-lg-3" style="padding:0; margin-top: 0;">
<label>chairs</label>
<input
type="text"
name="chairs"
id="chairs"
ng-model="data.home.chairs"
required
changeinput
ng-maxlength="10"
ng-minlength="10"
maxlength="10"
md-maxlength="10"
ng-pattern="/^[2]{0,1}[m|M]{0,1}[2]{0,1}[a-zA-Z0-9]{0,7}$/"
/>
<div ng-messages="formExample.chairs.$error" ng-if="formExample.chairs.$dirty" md-auto-hide="false">
<div ng-message="required && !valid">Required 2M26123200</div>
</div>
</md-input-container>
这个wolud值得关注
,$ scope.data将绑定到ngmodel
$scope.data = {};
$scope.$watch('data', function (newValue, oldValue) {
// check duplicates in ngmodel
}, true);
但我不知道如何在这种情况下使用$ watch