AbstractFormGroupDirective

A base class for code shared between the NgModelGroup and FormGroupName directives.

class AbstractFormGroupDirective extends ControlContainer implements OnInit, OnDestroy { control: FormGroup path: string[] formDirective: Form | null validator: ValidatorFn | null asyncValidator: AsyncValidatorFn | null ngOnInit(): void ngOnDestroy(): void // 继承自 forms/ControlContainer name: string formDirective: Form | null path: string[] | null // 继承自 forms/AbstractControlDirective abstract control: AbstractControl | null value: any valid: boolean | null invalid: boolean | null pending: boolean | null disabled: boolean | null enabled: boolean | null errors: ValidationErrors | null pristine: boolean | null dirty: boolean | null touched: boolean | null status: string | null untouched: boolean | null statusChanges: Observable<any> | null valueChanges: Observable<any> | null path: string[] | null reset(value: any = undefined): void hasError(errorCode: string, path?: string[]): boolean getError(errorCode: string, path?: string[]): any }
      
      class AbstractFormGroupDirective extends ControlContainer implements OnInit, OnDestroy {
  control: FormGroup
  path: string[]
  formDirective: Form | null
  validator: ValidatorFn | null
  asyncValidator: AsyncValidatorFn | null
  ngOnInit(): void
  ngOnDestroy(): void

  // 继承自 forms/ControlContainer
  name: string
  formDirective: Form | null
  path: string[] | null

  // 继承自 forms/AbstractControlDirective
  abstract control: AbstractControl | null
  value: any
  valid: boolean | null
  invalid: boolean | null
  pending: boolean | null
  disabled: boolean | null
  enabled: boolean | null
  errors: ValidationErrors | null
  pristine: boolean | null
  dirty: boolean | null
  touched: boolean | null
  status: string | null
  untouched: boolean | null
  statusChanges: Observable<any> | null
  valueChanges: Observable<any> | null
  path: string[] | null
  reset(value: any = undefined): void
  hasError(errorCode: string, path?: string[]): boolean
  getError(errorCode: string, path?: string[]): any
}
    

属性

属性说明
control: FormGroup 只读

The FormGroup bound to this directive.

path: string[] 只读

The path to this group from the top-level directive.

formDirective: Form | null 只读

The top-level directive for this group if present, otherwise null.

validator: ValidatorFn | null 只读

The synchronous validators registered with this group.

asyncValidator: AsyncValidatorFn | null 只读

The async validators registered with this group.

方法

An internal callback method triggered on the instance after the inputs are set. Registers the group with its parent group.

ngOnInit(): void
      
      ngOnInit(): void
    
参数

没有参数。

返回值

void

An internal callback method triggered before the instance is destroyed. Removes the group from its parent group.

ngOnDestroy(): void
      
      ngOnDestroy(): void
    
参数

没有参数。

返回值

void