0

現在、ユーザーが[次のステップ]をクリックするとフォームの次の部分が表示されるAngularフォームを使用しています。ただし、すべてのフィールドが有効になるまで次のステップボタンが無効になるように設定しています。

私の質問は、ユーザーが次のステップのボタンをクリックしたときに完了していないフィールドを強調表示するために作成したクラスを追加するにはどうすればよいですか?$ scope.watchを使用する必要がありますか、それとも無効なフォームのソースを根絶する簡単な方法がありますか?

4

1 に答える 1

0

if I understand the question correctly, the documentation has a good example of what you are trying to accomplish: http://docs.angularjs.org/api/ng.directive:form

there a message is displayed if the field is empty

<form name="myForm" ng-controller="Ctrl">
  userType: <input name="input" ng-model="userType" required>
  <span class="error" ng-show="myForm.input.$error.required">Required!</span>
于 2013-01-15T00:35:17.883 に答える