<!-- todo disabled -->
-<ng-template #displayTemplate let-r="result">
+<ng-template #defaultDisplayTemplate let-r="result">
{{r.label || r.id}}
</ng-template>
[required]="isRequired"
[(ngModel)]="selected"
[ngbTypeahead]="filter"
- [resultTemplate]="displayTemplate"
+ [resultTemplate]=" displayTemplate || defaultDisplayTemplate"
[inputFormatter]="formatDisplayString"
(click)="onClick($event)"
(blur)="onBlur()"
* <!-- see also <eg-combobox-entry> -->
* </eg-combobox>
*/
-import {Component, OnInit, Input, Output, ViewChild, EventEmitter, ElementRef, forwardRef} from '@angular/core';
+import {Component, OnInit, Input, Output, ViewChild,
+ TemplateRef, EventEmitter, ElementRef, forwardRef} from '@angular/core';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
import {Observable, of, Subject} from 'rxjs';
import {map, tap, reduce, mergeMap, mapTo, debounceTime, distinctUntilChanged, merge, filter} from 'rxjs/operators';
}
}
+ // When provided use this as the display template for each entry.
+ @Input() displayTemplate: TemplateRef<any>;
+
// Emitted when the value is changed via UI.
// When the UI value is cleared, null is emitted.
@Output() onChange: EventEmitter<ComboboxEntry>;