当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript AbstractControl.markAsTouched方法代码示例

本文整理汇总了TypeScript中@angular/forms.AbstractControl.markAsTouched方法的典型用法代码示例。如果您正苦于以下问题:TypeScript AbstractControl.markAsTouched方法的具体用法?TypeScript AbstractControl.markAsTouched怎么用?TypeScript AbstractControl.markAsTouched使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@angular/forms.AbstractControl的用法示例。


在下文中一共展示了AbstractControl.markAsTouched方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: buildForm

 private buildForm(): void {
     this.form = this.formBuilder.group({
         firstName: [this.firstName, Validators.required],
         lastName: [this.lastName, Validators.required],
         email: [this.email, Validators.compose([Validators.required, CustomValidators.email])]
     });
     this.firstNameControl = this.form.controls.firstName;
     this.lastNameControl = this.form.controls.lastName;
     this.emailControl = this.form.controls.email;
     if (this.item) {
         this.firstNameControl.markAsTouched();
         this.lastNameControl.markAsTouched();
         this.emailControl.markAsTouched();
     }
 }
开发者ID:taylorjg,项目名称:Angular2Dialog,代码行数:15,代码来源:nameListItemModalContent.component.ts

示例2: showErrors

export function showErrors(control: AbstractControl) {
    if ((control as FormGroup | FormArray).controls) {
        // tslint:disable-next-line:forin
        for (const name in (control as FormGroup | FormArray).controls) {
            showErrors((control as FormGroup).controls[name]);
        }
    }
    control.markAsTouched({ onlySelf: true });
    control.updateValueAndValidity({ onlySelf: true });
}
开发者ID:mikule1,项目名称:epool.eu,代码行数:10,代码来源:showErrors.ts

示例3: markAsDeeplyTouched

export function markAsDeeplyTouched(control: AbstractControl): void {
  // Mark this control as touched
  control.markAsTouched();

  // Recursively mark any control children as touched
  if (control instanceof FormGroup) {
    Object.keys(control.controls).forEach(key => {
      const c2 = control.get(key);
      if (c2) {
        markAsDeeplyTouched(c2);
      }
    });
  }
}
开发者ID:ng-vcl,项目名称:ng-vcl,代码行数:14,代码来源:utils.ts

示例4: dirty

 /*
  Ensures a programmatic change to an AbstractControl value is marked as dirty (and by default as touched)
  prior to the change, properly invoking validation and the display of any validation errors.
 */
 changeControlValue( control: AbstractControl, value: any, markTouched: boolean = true ) : void {
     control.markAsDirty();
     control.markAsTouched( markTouched );
     control.setValue( value );
 }
开发者ID:bcswartz,项目名称:angular2-sandbox-guildrunner,代码行数:9,代码来源:vadacl.ts


注:本文中的@angular/forms.AbstractControl.markAsTouched方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。