我正在使用PrimeNG,但无法添加一些按钮来清除输入。 这是我的html:
<p-dropdown (keyup)='search($event)'
id = "dropdown"
(onChange)="changeSubject($event.value)"
[options]="subjects"
[(ngModel)]="selectedSubject"
filterBy = 'subjects'
[filter] = 'true'
[autoDisplayFirst] = 'defaultFilter'
#dropdown
placeholder="{{selectedWord}}"
[style]="{'width':'100%', 'height': '30px'}">
</p-dropdown>
答案 0 :(得分:0)
您可以添加showClear
属性,并将其设置为 true :
<p-dropdown (keyup)='search($event)'
id = "dropdown"
(onChange)="changeSubject($event.value)"
[options]="subjects"
[(ngModel)]="selectedSubject"
filterBy = 'subjects'
[filter] = 'true'
[autoDisplayFirst] = 'defaultFilter'
#dropdown
placeholder="{{selectedWord}}"
[style]="{'width':'100%', 'height': '30px'}"
showClear="true">
</p-dropdown>