Error Collect
IMPORT MODULE

A simple form exception messages collector that jump to element location via click icon; it must be a standard form.

Examples

0
基础

一般配合 footer-toolbar 一起使用。

expand codeexpand code
import { Component, OnInit } from '@angular/core';
import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';

@Component({
  selector: 'components-error-collect-basic',
  template: `
    <form nz-form [formGroup]="validateForm">
      <nz-form-item>
        <nz-form-control>
          <input nz-input formControlName="email" id="email" />
        </nz-form-control>
      </nz-form-item>
      <error-collect></error-collect>
    </form>
  `,
})
export class ComponentsErrorCollectBasicComponent implements OnInit {
  validateForm: FormGroup;

  constructor(fb: FormBuilder) {
    this.validateForm = fb.group({
      email: [null, [Validators.required]],
    });
  }

  get email(): AbstractControl {
    return this.validateForm.controls.email;
  }

  ngOnInit(): void {
    this.email.markAsDirty();
  }
}

API

error-collect

PropertyDescriptionTypeDefaultGlobal Config
[freq]Monitor frequency, unit is millisecondsnumber500
[offsetTop]Top offset, unit is pxnumber145