遇到如下的错误消息:

nz-input-group is not a known element的解决方法

Failed to compile.

src/app/ngrxdemo/searchbookcomponents/search-input/search-input.component.html:4:3 - error NG8001: ‘nz-input-group’ is not a known element:

  1. If ‘nz-input-group’ is an Angular component, then verify that it is part of this module.
  2. If ‘nz-input-group’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message.

4 <nz-input-group [nzSuffix]=“suffixIconSearch” class=“search”>

添加如下依赖到package.json:
“ng-zorro-antd”: “^7.5.1”,

nz-input-group is not a known element的解决方法

npm install:

nz-input-group is not a known element的解决方法

发现一系列warning,原因是因为ng-zorro-antd和Angular的版本不一致:

nz-input-group is not a known element的解决方法
nz-input-group is not a known element的解决方法
nz-input-group is not a known element的解决方法
nz-input-group is not a known element的解决方法

加入下列语句后问题解决:

import {NgZorroAntdModule} from ‘ng-zorro-antd’;

nz-input-group is not a known element的解决方法

要获取更多Jerry的原创文章,请关注公众号"汪子熙":
nz-input-group is not a known element的解决方法

相关文章: