Ngx-bootstrap: Typeahead - highlight matching string with typeaheadItemTemplate

Created on 18 Oct 2017  路  4Comments  路  Source: valor-software/ngx-bootstrap

Typeahead - highlight matching string with typeaheadItemTemplate

ngx-bootstrap: 2.0.5 beta

Angular: 4.4.3

Bootstrap: 3

Build system: Angular CLI

It seems that when we use the Typeahead with typeaheadItemTemplate, the matching string is not highlighted in the suggestion. (see https://valor-software.com/ngx-bootstrap/#/typeahead#item-template)

comp(typeahead) easy (hours) doc

Most helpful comment

Ok, got it :)
Actually, it was intended to be this way, because typeaheadItemTemplate option was implemented to give user a full control over template, that's why there's no highlighting. It can be achieved by formatting data in the template itself - just declare one more let-* variable like let-query="query" and then manipulate it as you wish. Anyway, the docs say nothing about this ability so I'll add a few lines about it soon.

A little example - https://plnkr.co/edit/lwf8DjJYaQTKDs4flUmH?p=preview

All 4 comments

Could you create a plunkr/stackblitz with reproduction?
You can use one of starter templates:
Plunkr: https://plnkr.co/edit/0NipkZrnckZZROAcnjzB?p=preview
StackBlitz: https://stackblitz.com/edit/ngx-bootstrap-stack?file=app%2Fapp.module.ts

Ok, got it :)
Actually, it was intended to be this way, because typeaheadItemTemplate option was implemented to give user a full control over template, that's why there's no highlighting. It can be achieved by formatting data in the template itself - just declare one more let-* variable like let-query="query" and then manipulate it as you wish. Anyway, the docs say nothing about this ability so I'll add a few lines about it soon.

A little example - https://plnkr.co/edit/lwf8DjJYaQTKDs4flUmH?p=preview

Ok, thank you :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

haisaco picture haisaco  路  3Comments

RolfVeinoeSorensen picture RolfVeinoeSorensen  路  3Comments

phmello picture phmello  路  3Comments

KimBum picture KimBum  路  3Comments

webdev48 picture webdev48  路  3Comments