模太框刷新问题,加了验证。第一次新增的时候输入了input内容点保存,第二次再点新增验证不可空就显示出来了。
<div class="actions" >
<div class="btn-group" ng-class="{'discolor':edite==true}">
<a class="btn green-haze btn-outline btn-sm" ng-click="fromupdate()" data-toggle="modal" data-target="#Job-type" data-close-others="true">
<i class="glyphicon glyphicon-plus"></i>
新增职称
</a>
</div>
</div>
<div style="position: absolute;top: 18%;right:22%" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" id="Job-type" aria-labelledby="myLargeModalLabel" aria-haspopup="true" aria-hidden="true" aria-expanded="false">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title">职称</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" role="form" name="createAcc_form">
<input ng-class="{'red':createAcc_form.job.$invalid && !createAcc_form.job.$pristine}" ng-minlength="2"
required name="job" class="form-control ng-pristine ng-valid" ng-model="job.name" type="text" style="display:inline-block;"
>
</form>
<p class="text-muted">长度限制为2-50个字符。</p>
<p class="text-muted" ng-show="createAcc_form.job.$invalid && !createAcc_form.job.$error.required" style="color:red">职称不合法</p>
<div ng-show="createAcc_form.job.$dirty && createAcc_form.job.$invalid">
<p class="text-muted" ng-if="createAcc_form.job.$error.required" style="color:red">职称不能为空</p>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" ng-click="cancel()">关 闭</button>
<input type="button" class="btn btn-primary" ng-disabled="createAcc_form.$invalid" ng-click="zcSure()" value="保 存 ">
</div>
</div>
</div>
</div>