WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

AngularJS ng-required Directive


Example

Make the information field required:

Required:
<input type="checkbox" ng-model="myVar">

<input name="myInput" ng-model="myInput" ng-required="myVar">
Try it yourself »

Definition and Usage

The ng-required mandate sets the required property of a structure field (input or textarea).

The structure field will be required if the articulation inside the ng-required quality returns true.

The ng-required order is important to almost certainly move the esteem between true and false. In HTML, you can't set the required ascribe to false (the nearness of the required quality makes the component required, paying little respect to it's value).


Syntax

<input ng-required="expression"></input>

Supported by <input>, <select>, and <textarea> and other editable elements


Parameter Values

Value Description
expression An articulation that will set the required trait on the off chance that it returns true.