AngularJS ng-required inisye

paglilinaw at paggamit

ng-required Ang inisye ay nagtatakda ng form field (input o text area) na required property.

kung ng-required ang expression na binabalik ng property truekaya ang form field ay magiging required.

ng-required Ang inisye ay kailangan para sa pag-alis-alis ng halaga sa pagitan ng true at false. Sa HTML, hindi mo pwedeng itakda ang required na property bilang false (ang pagkakaroon ng required property ay magiging required ang elemento, kahit anong halaga nito).

Example

Set the input field to required:

Required:

<input type="checkbox" ng-model="myVar">
<input name="myInput" ng-model="myInput" ng-required="myVar">

Try it yourself

Syntax

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

Affected <input>,<select> and <textarea> and other editable elements supported.

Parameters

Parameters Description
expression If it returns true, the expression that sets the required attribute will be set.