<div class="form-group" ng-class="{'active': field == 'country', 'has-error has-feedback' :Country.$invalid && submitted}">
<label class="col-xs-2 control-label muted" for="Country">Country</label>
<div class="col-xs-9">
<input type="text" class="form-control" id="Country" name="Country" ng-change="ChangesMade()" ng-model="data.country" ng-readonly="previewMode" ng-focus="field='country';showHelp()" ng-required="contactPersonId">
</div>
</div>
根据该字段,状态是必需的。但它可以是大写或小写如何我可以添加过滤器
<div class="col-xs-4 pad-none" ng-class="{'has-error has-feedback' : (data.country =='US' || data.country =='CANADA' | uppercase) && State.$invalid && submitted }">
<div class="col-xs-4" >
<label class="control-label muted" for="State">State</label>
</div>
<div class="col-xs-8 pad-none">
<input type="text" class="form-control" id="State" name="State" ng-change="ChangesMade()" ng-model="data.state" ng-readonly="previewMode" ng-focus="field='state';showHelp()" ng-required="data.country =='US' || data.country =='Canada' ">
</div>
</div>
答案 0 :(得分:1)
尝试:
ng-required="data.country.toUpperCase() === 'US' || data.country =='Canada'"