我正在試圖防止形式從如果輸入未經驗證尚未提交..AngularJS防止提交如果輸入尚未驗證
這裏是我的代碼:
HTML
<form method="post" enctype="multipart/form-data" ng-submit="insertCustomer(insertProfile)" id="form-customer" name="form" class="css-form" novalidate >
<div class="row">
<div class="col-md-7">
<label>Full Name*
<span class="required-label" ng-show="form.$submitted || form.full_name.$touched">
<span ng-show="form.full_name.$error.required">(Full Name is required.)</span>
</span>
</label>
<input type="text" ng-model="insertProfile.full_name" name="full_name" class="form-control" required="" />
</div>
</div>
</form>
<button type="submit" form="form-customer"
class="btn btn-primary pull-right" id="cmd_insert_customer" ng-show="tab == 3">
Insert Customer
</button>
我試過使用ng-submit = "form.$valid && insertCustomer(insertProfile)"
...如果輸入爲空,但是當我輸入數值時,表單不會提交...它仍然不會提交...
對不起,我的壞人......它沒有提交,因爲有其他輸入是必需的....對不起我的壞... –