0
Angular Jsフォームと送信ボタンにはほとんどコントロールがありません。フィールドが空であるかどうかを検証しています。ただし、すべてのデータが入力されても、フォームは提出されません。無効なデータを持つコントロールを特定する+ AngularJS
Index.cshtml
<body class="ng-cloak">
<div ng-controller="testController" ng-init="init()">
<form name="mainForm" id="createForm" ng-submit="mainForm.$valid && add()" novalidate="">
<div class="container" ng-show="createMenu">
<div class="row">
<div class="col-sm-2">
<label>Name :</label>
</div>
<div class="col-md-6 form-group">
<input type="text" maxlength="150" class="input-md form-control col-md-4" required="" ng-model="testName" name="testName" />
</div>
</div>
<span style="color:red" ng-show="submitted == true && mainForm.testName.$error.required">Name is required</span>
//other controls
<input type="submit" value="Submit" ng-click="submitted=true" />
無効なデータを持っているコントロールをチェックする任意の識別子や方法はあります:以下は私が持っているサンプルコードはありますか?あなただけthe $error
property of the form controllerをプリントアウトすることができ、デバッグ目的 おかげ
プロパティ 'mainForm。$ error'をチェックアウトしてください。 [documentation](https://docs.angularjs.org/api/ng/type/form.FormController#$error) – devqon
を参照してください。使用方法 – venkat14
あなたが望む場所に依存します。デバッグの目的のために、どこかに要素を追加するだけでよい: '
' – devqon