Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 将输入清除按钮添加到启动p下拉列表_Html_Typescript_Angular5_Primeng_Primeng Dropdowns - Fatal编程技术网

Html 将输入清除按钮添加到启动p下拉列表

Html 将输入清除按钮添加到启动p下拉列表,html,typescript,angular5,primeng,primeng-dropdowns,Html,Typescript,Angular5,Primeng,Primeng Dropdowns,我正在使用Priming,无法添加一些按钮来清除输入。 这是我的html: <p-dropdown (keyup)='search($event)' id = "dropdown" (onChange)="changeSubject($event.value)" [options]="subjects"

我正在使用Priming,无法添加一些按钮来清除输入。 这是我的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>

您可以添加
showClear
property并将其设置为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>