テキストボックスを検証する必要があります。私はng-required = "true"を使用していますが、必須メッセージを表示していません。保存ボタンをクリックすると、save()関数に直接置き換えられます。それを避ける方法。AngularJSのテキストボックスを検証する方法
<div ng-app="LearnApp" ng-controller="csrControl">
<table>
<tr>
<td>
Name
</td>
<td>
:
</td>
<td>
<input id="txtName" type="text" ng-model="txtName" ng-required="true" placeholder="Name" />
</td>
</tr>
<tr>
<td>
Address
</td>
<td>
:
</td>
<td>
<input id="txtAddress" type="text" ng-model="txtAddress" ng-required="true" placeholder="Address" />
</td>
</tr>
<tr>
<td colspan="3" align="right">
<input id="btnSave" type="button" value="Save" class="button" ng-click="save()" />
<input id="btnCancel" type="button" value="Cancel" class="button" />
</td>
</tr>
</table>
</div>
<script type="text/javascript">
var app = angular.module("LearnApp", []);
app.controller("csrControl", function ($scope, $http) {
$scope.save = function() {
};
});
</script>
でそれを試してみてくださいだけでなく、 – rrd
あなたが見ることを期待しないメッセージangularjs –
でのフォーム検証を確認してください=「true」をNG-必要な「必要な」?私は、(エラー)メッセージを含むHTMLは表示されません。または、html5の検証をトリガーしたいだけですか? – devqon