nz-select、nz-cascader等组件和FormGroup结合报错:NG01354
Author: ifuyunCreated Aug 27, 2026Updated Sep 1, 2026
Reproduction link
https://stackblitz.com/edit/wgyfn7qo?file=src%2Fapp%2Fapp.ts
Steps to reproduce
- 定义一个FormGroup,在FormGroup中定义一个nz-select或nz-cascader等组件;
- 打开页面,或刷新页面;
- 打开控制台,可以看到错误。
What is expected?
不报错,正常兼容 Angular 22。
What is actually happening?
控制台报错:
NG01354: ngModel on a form control inside a child component cannot register with the FormGroupDirective in the parent component because @Host() stops injection at the component boundary. To register this control with the parent form, add viewProviders to the child component: @Component({ ..., viewProviders: [{ provide: ControlContainer, useExisting: FormGroupDirective }] }). Or, to opt out of form registration, use [ngModelOptions]="{standalone: true}". Find more at https://v22.angular.dev/errors/NG01354| Environment | Info |
|---|---|
| ng-zorro-antd | 22.0.1 |
| Browser | Chome 151.0.7922.108 |
Source: NG-ZORRO/ng-zorro-antd