0.0.8 • Published 4 years ago

@ngx-reflective-forms/core v0.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Getting Started

export class TestFormModel {
  name: string;
  surname: string;
  attributeWithoutControl = 10;
}
@Injectable()
export class TestFormGroup extends FormGroup<TestFormModel> {
  @Control()
  @Default("Miguel")
  @Validator(TestFormValidator.validateName)
  public name: TextFormControl = undefined as any;

  @Control()
  @Default("Franken")
  public surname: TextFormControl = undefined as any;
}
export class TestFormValidator {
    public static validateName(this: TextFormControl): void {
      if (this.value.length > 5) {
        throw new ValidationError("Max. 5 Characters");
      }
    }
}
@Component({
  selector: "app-root",
  templateUrl: "./app.component.html",
  providers: [TestFormGroup],
})
export class AppComponent implements OnInit {
  constructor(private form: TestFormGroup) {
  }
  
  ngOnInit(): void {
    this.form.init();
  }
}
0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago