primeng自动完成功能不起作用 [英] primeng autocomplete functionality is not working

查看:63
本文介绍了primeng自动完成功能不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在 app.module.ts 文件中添加了AutoCompleteModule.

I have added the AutoCompleteModule in app.module.ts file.

import { AutoCompleteModule } from 'primeng/autocomplete';

但是自动完成功能无法按预期工作.我遇到以下错误:

But autocomplete is not working as expected. I am getting below error:

Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'p-autoComplete'.
1. If 'p-autoComplete' is an Angular component and it has 'ngModel' input, then verify that it is part of this module.
2. If 'p-autoComplete' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

我正在使用最新版本.

我尝试在 app.module.ts 中添加自动完成模块.在此之后,我重建了应用程序,但仍然出现上述错误.任何帮助,将不胜感激.谢谢

I have tried adding autocomplete module in app.module.ts. After this I rebuild the application but still it is giving above error. Any help would be appreciated. Thanks

推荐答案

像这样使用它:

<p-autoComplete  ... [(ngModel)]="WHATEVER" ...></p-autoComplete>

这就是将ngModel与primeng组件一起使用的方式.

That's how you use ngModel with primeng components.

这篇关于primeng自动完成功能不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆