@ ng-select / ng-select在键入时显示下拉菜单

时间:2019-01-09 05:50:35

标签: angular typescript angular-ngselect

我正在使用, ng-select 我有一个多选下拉菜单 一切正常,但我想进行一些更改,我想在用户开始键入内容时显示下拉列表,并仅在文本框中显示用户键入内容上的过滤数据。

1 个答案:

答案 0 :(得分:1)

我希望以下逻辑对您有所帮助,

.HTML

$pdf_html = view('frontend.pdf.pdf_template', $data)->render();
    $pdf = new Pdf;
    $pdf->addPage($pdf_html);


    if (!$pdf->saveAs(public_path() . '/assets/invoices_pdf/invoice_' . $tran_id . '.pdf')) {
        $error = $pdf->getError();
        print '<pre>'; print_r($error); print('</pre>'); die();
    }

.TS

<ng-select #elem [items]="cities2"
               bindLabel="name"
               bindValue="id"
               [multiple]="true"
               placeholder="Select cities"
               [(ngModel)]="selectedCityIds"
               (open)="onOpen(elem)">

如果要隐藏下拉开关(V),则需要在父组件/文件中添加样式。

Index.html

onOpen(elem){
 if(elem.filterInput.nativeElement.value == ""){
   elem.close();
 }
}
相关问题