私はanuglar.jsフォーム検証を使用しています。 フォーム送信ボタンなしで検証を確認したいと思います。送信ボタンのない角度フォームの検証
これは私のhtmlです。
<form name="userForm">
<input type="hidden" ng-model="StandardID" />
<div class="form-group">
<label for="email">Name:</label>
<input type="text" class="form-control" ng-model="Name" placeholder="Name" maxlength="50" required>
<span ng-show="userForm.Name.$dirty && !userForm.Name.$valid">Name is required.</span>
</div>
<div class="form-group">
<label for="pwd">Alias:</label>
<input type="text" class="form-control" ng-model="Alias" placeholder="Alias" maxlength="50" required>
</div>
<button type="submit" class="btn btn-info" ng-click="update()">Submit</button>
<button type="submit" class="btn btn-info" data-dismiss="modal">Cancel</button>
</form>
マイコンjsです。
$scope.update= function() {
alert($scope.userForm.Name.$valid);
if ($scope.userForm.Name.$valid) {
alert("Entry added");
}
}
このフィールドが必須であることを示す小さなダイアログが表示されます。私はこのポップアップを望んでいない。スパンセクションが表示されない理由
が機能しません。私は前にそれをしましたが、私はこのコードで何が間違っているのか分かりません。スパンセクションが表示されない理由 – user3248761