Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link

Description

@rlzdesenv
Issue body actions

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 {
    }

}
Reactions are currently unavailable

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

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.