Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.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
Javascript 如何将自定义HTML添加到ngx Typeahead?_Javascript_Angular_Ngx Bootstrap - Fatal编程技术网

Javascript 如何将自定义HTML添加到ngx Typeahead?

Javascript 如何将自定义HTML添加到ngx Typeahead?,javascript,angular,ngx-bootstrap,Javascript,Angular,Ngx Bootstrap,就像google search在typeahead下拉列表的底部有两个按钮一样,我如何向ngxTypeahead下拉列表添加一些html 业务分类* {{result.result.classification} SIC{{result.result.sicCode} 您可以使用自定义模板获取结果,并在末尾添加所需的按钮 大概是这样的: <ng-template #rt let-r="result" let-t="term"> <ngb-highlight [result

就像google search在typeahead下拉列表的底部有两个按钮一样,我如何向ngxTypeahead下拉列表添加一些
html


业务分类*
{{result.result.classification}
SIC{{result.result.sicCode}

您可以使用自定义模板获取结果,并在末尾添加所需的按钮

大概是这样的:

<ng-template #rt let-r="result" let-t="term">
  <ngb-highlight [result]="r.name" [term]="t"></ngb-highlight>
  <button>Save</button>
  <button>Cancel</button>
</ng-template>

<label for="typeahead-template">Search for a state:</label>
<input id="typeahead-template" type="text" class="form-control" [(ngModel)]="model" [ngbTypeahead]="search" [resultTemplate]="rt"
  [inputFormatter]="formatter" />
<hr>

拯救
取消
搜索一个状态:

参考: