Home > OS >  Angular typehead how to use {{value.name}} template?
Angular typehead how to use {{value.name}} template?

Time:04-01

Default print is:

          <div >
            <input
              id="typeahead-config"
              type="text"
              
              [(ngModel)]="model"
              [ngbTypeahead]="search"
              formControlName="searchText"
              [resultFormatter]="formatter" [inputFormatter]="formatter"
            />
          </div>

How I can use {{item.name}} {{item.somevalue}} <-- this template?

I need to print somevalues in <b></b> and <i></i> tags. Thank you!

CodePudding user response:

@skouch2022 is right.

<ng-template #rt let-r="result" let-t="term">
   your somevalue: <b>{{r['id']}}</b> <-- your b or i tag
   <ngb-highlight [result]="r.name" [term]="t"></ngb-highlight>
</ng-template>
  • Related