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

Angular: Error: NG01350 even if i'm not using an ngModel

Discussão em 'Angular' iniciado por Oder Risi, Maio 29, 2025.

  1. Oder Risi

    Oder Risi Guest

    ERROR Error: NG01350:
    ngModel cannot be used to register form controls with a parent formGroup directive. Try using
    formGroup's partner directive "formControlName" instead.

    In your class:

    this.myGroup = new FormGroup({ firstName: new FormControl() });

    Or, if you'd like to avoid registering this form control, indicate that it's standalone in ngModelOptions:

    Example:

    <div [formGroup]="myGroup">
    <input formControlName="firstName">
    <input [(ngModel)]="showMoreControls" [ngModelOptions]="{standalone: true}">


    In the browser I'm receiving this error, but in my code there's no ngModel:

    <form appInputAutocomplete #addnew [formGroup]="addNewFormGroup">
    <nz-select
    style="min-width: 300px; margin-left: 10px"
    formControlName="linkVisible"
    nzMode="multiple"
    nzAllowClear
    nzPlaceHolder="Seleziona"
    [nzDisabled]="!addNewFormGroup.get('linkVisibleToggle').value">
    <nz-option
    *ngFor="let option of linkVisibleTypes"
    [nzLabel\]="option.label"
    [nzValue]="option.value">
    </nz-option>
    </nz-select>
    </form>


    I also tried adding [ngModelOptions]="{standalone: true}" but the error is still there. I tried replacing the nz-select with a normal select and the error goes away, but i have to use the nz-select, can anyone help me?

    Continue reading...

Compartilhe esta Página