File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,11 @@ import {NgbHighlight} from './highlight';
3
3
4
4
import { toString } from '../util/util' ;
5
5
6
- export class ResultTplCtx {
7
- constructor ( public result , public term : string , public formatter : ( result ) => string ) { }
8
- }
6
+ export type ResultTplCtx = {
7
+ result : string ,
8
+ term : string ,
9
+ formatter : ( _ : string ) => string
10
+ } ;
9
11
10
12
@Component ( {
11
13
selector : 'ngb-typeahead-window' ,
@@ -19,7 +21,8 @@ export class ResultTplCtx {
19
21
<button class="dropdown-item" [class.active]="idx === _activeIdx"
20
22
(mouseenter)="markActive(idx)"
21
23
(mousedown)="select(result)">
22
- <template [ngTemplateOutlet]="resultTemplate || rt" [ngOutletContext]="_prepareTplCtx(result)"></template>
24
+ <template [ngTemplateOutlet]="resultTemplate || rt"
25
+ [ngOutletContext]="{result: result, term: term, formatter: formatter}"></template>
23
26
</button>
24
27
</template>
25
28
` ,
@@ -68,6 +71,4 @@ export class NgbTypeaheadWindow {
68
71
prev ( ) { this . _activeIdx = ( this . _activeIdx === 0 ? this . results . length - 1 : this . _activeIdx - 1 ) ; }
69
72
70
73
select ( item ) { this . selectEvent . emit ( item ) ; }
71
-
72
- private _prepareTplCtx ( result : any ) { return new ResultTplCtx ( result , this . term , this . formatter ) ; }
73
74
}
You can’t perform that action at this time.
0 commit comments