Pages UI
Search…
Typeahead
Typeahead is powered by the plugin ngx-bootstrap. Please refer there documentation for further details and instructions here https://valor-software.com/ngx-bootstrap/#/typeahead

Importing

First import it to your app module or any submodule as you wish
1
import { TypeaheadModule } from 'ngx-bootstrap';
2
@NgModule({
3
imports: [TypeaheadModule,...]
4
})
5
export class AppModule(){}
Copied!

How to use

HTML
Typescript
1
<div class="form-group typehead">
2
<input placeholder="States of USA" [(ngModel)]="selectedState" [typeahead]="states" [typeaheadScrollable]="true" [typeaheadOptionsInScrollableView]="5" class="form-control">
3
</div>
Copied!
1
selectedState;
2
states: string[] = [
3
'Alabama',
4
'Alaska',
5
'Arizona',
6
'Arkansas',
7
'California',
8
'Colorado',
9
'Connecticut',
10
'Delaware',
11
'Florida',
12
'Georgia',
13
'Hawaii',
14
'Idaho',
15
'Illinois',
16
'Indiana',
17
'Iowa',
18
'Kansas',
19
'Kentucky',
20
'Louisiana',
21
'Maine',
22
'Maryland',
23
'Massachusetts',
24
'Michigan',
25
'Minnesota',
26
'Mississippi',
27
'Missouri',
28
'Montana',
29
'Nebraska',
30
'Nevada',
31
'New Hampshire',
32
'New Jersey',
33
'New Mexico',
34
'New York',
35
'North Dakota',
36
'North Carolina',
37
'Ohio',
38
'Oklahoma',
39
'Oregon',
40
'Pennsylvania',
41
'Rhode Island',
42
'South Carolina',
43
'South Dakota',
44
'Tennessee',
45
'Texas',
46
'Utah',
47
'Vermont',
48
'Virginia',
49
'Washington',
50
'West Virginia',
51
'Wisconsin',
52
'Wyoming'
53
];
Copied!
Copy link