填寫這份《一分鐘調查》,幫我們(開發組)做得更好!去填寫Home

EmailValidator

該指令會藉助 NG_VALIDATORS 繫結把 email 驗證器新增到任何帶有 email 屬性的控制元件上。

A directive that adds the email validator to controls marked with the email attribute. The directive is provided with the NG_VALIDATORS multi-provider list.

參見

Exported from

選擇器

屬性

屬性說明
@Input()
email: string | boolean
只寫

追蹤繫結到該指令的 email 屬性的更改。

Tracks changes to the email attribute bound to this directive.

說明

新增 email 驗證器

Adding an email validator

下面的例子示範瞭如何為一個帶有 ngModel 繫結的輸入框新增 email 驗證器。

The following example shows how to add an email validator to an input attached to an ngModel* binding.

      
      <input type="email" name="email" ngModel email>
<input type="email" name="email" ngModel email="true">
<input type="email" name="email" ngModel [email]="true">