PrimeNG 下拉按钮未 reacting/working 正确
PrimeNG Dropdown Button not reacting/working properly
所以我正在学习如何实现 prime ng 下拉按钮的教程:https://www.primefaces.org/primeng/showcase/#/dropdown
我按照教程进行操作,设计的下拉按钮显示值为“New York”。但是当我点击它时,没有任何反应。我希望它会下拉并向我显示其他选项,但什么也没有发生。我也安装了 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'}
];
}
我做错了什么?
呸,这很有趣。显然我的 module.ts 中没有导入 BrowserAnimationsModule
。导入后,一切正常。
所以我正在学习如何实现 prime ng 下拉按钮的教程:https://www.primefaces.org/primeng/showcase/#/dropdown
我按照教程进行操作,设计的下拉按钮显示值为“New York”。但是当我点击它时,没有任何反应。我希望它会下拉并向我显示其他选项,但什么也没有发生。我也安装了 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'}
];
}
我做错了什么?
呸,这很有趣。显然我的 module.ts 中没有导入 BrowserAnimationsModule
。导入后,一切正常。