1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

How to create a Formgroup using an interface in Angular

Discussão em 'Angular' iniciado por jason, Outubro 12, 2024.

  1. jason

    jason Guest

    I'm new to asking questions so please be understanding. I have and interface of USERS

    interface USERS {
    id: Number;
    name: String;
    username: String;
    email: String;
    }


    and I want to create a formbuilder that (if possible) will automatically make the properties that are needed. eg

    registrationForm = this.fb.group({
    userName: ['', [Validators.required, Validators.minLength(3), forbiddenNameValidator]],
    id: [''],
    name: [''],
    email: [''],


    Is there any way that this can happen ? I want to create larger interface and I don't want to manually put the necessary properties

    Continue reading...

Compartilhe esta Página