angular - PrimeNG 下拉按钮没有反应/正常工作
问题描述
因此,我正在关注本教程,了解如何实现 Prime ng 下拉按钮:https ://www.primefaces.org/primeng/showcase/#/dropdown
我按照教程操作,设计的下拉按钮显示为“纽约”。但是当我点击它时,什么也没有发生。我希望它会下拉并向我显示其他选项,但没有任何反应。我也安装了 angular/cdk。
我的html:
<p-dropdown [options]="cities" [(ngModel)]="selectedCityCode" optionLabel="name" optionValue="code"></p-dropdown>
我的 ts(缩短):
interface City {
name: string,
code: string
}
cities: City[];
selectedCityCode: string;
constructor() {
this.cities = [
{name: 'New York', code: 'NY'},
{name: 'Rome', code: 'RM'},
{name: 'London', code: 'LDN'},
{name: 'Istanbul', code: 'IST'},
{name: 'Paris', code: 'PRS'}
];
}
我究竟做错了什么?
解决方案
噗,这很有趣。BrowserAnimationsModule
显然我的module.ts 中没有导入。导入后,一切正常。
推荐阅读
- c# - 在 SQL 查询中传递 DECLARE 参数
- node.js - ListItemText 不显示数据
- javascript - Javascript:如何从“动态”创建的复选框中获取值
- c++ - 如何实现 std::atomic 引用计数器?
- python - Python - 检查字符串中是否至少包含 3 个数字
- perl - 将文件从数字排序转换为字母排序
- javascript - React/nextJS:如何调试 SSR react 应用的不同节点?
- php - 无法从购物车页面获取自定义字段数据到 woocommerce 中订单的结帐页面
- android - gradle有没有替代品?
- python - 传递值列表以在 Python 中重新映射