Skip to content

Type TypedFormGroup<> is not assignable to type FormGroup #273

@rlzdesenv

Description

@rlzdesenv

is it possible to remove this alert, i followed the whole manual to create the FormGroup

public form:NgxSubForm<Endereco, Endereco> help on to find out the name of the variables in [formControlName]="form.formControlNames.city"

image

<div class="row gy-1 gx-2" [formGroup]="form.formGroup">
    <div class="col-md-6">
        <app-input-text label="Email" [formControlName]="form.formControlNames.city"></app-input-text>
    </div>
</div>
import {Component, forwardRef, OnInit} from '@angular/core';
import {createForm, FormType, NgxSubForm, subformComponentProviders} from 'ngx-sub-form';
import {FormControl, FormGroup, Validators} from '@angular/forms';

export interface Endereco {
    street: string;
    city: string;
    state: string;
    zipCode: string;
}

@Component({
    selector: 'app-endereco-form',
    templateUrl: './endereco.form.html',
    styleUrls: ['./endereco.form.scss'],
    providers: subformComponentProviders( forwardRef(() => EnderecoForm) ),
})
export class EnderecoForm implements OnInit {

    public form:NgxSubForm<Endereco, Endereco> = createForm<Endereco>(this, {
        formType: FormType.SUB,
        formControls: {
            street: new FormControl(null, Validators.required),
            city: new FormControl(null, Validators.required),
            state: new FormControl(null, Validators.required),
            zipCode: new FormControl(null, Validators.required),
        },
    });

    constructor() {
    }

    ngOnInit(): void {
    }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions