Skip to content
Related Articles
Open in App
Not now

Related Articles

Angular ngx Bootstrap Typeahead Component

Improve Article
Save Article
  • Last Updated : 06 Jan, 2023
Improve Article
Save Article

Angular ngx bootstrap is a bootstrap framework used with angular to create components with great styling and this framework is very easy to use and is used to make responsive websites.
In this article, we will know how to use Typeahead in angular ngx bootstrap.

Installation syntax:

npm install ngx-bootstrap --save 


  • First, install the angular ngx bootstrap using the above-mentioned command.
  • add the following script in index.html

<link href=”” rel=”stylesheet”>

  • Import typeahead component in module.ts
  • In app.component.html make a typeahead component.
  • Serve the app using ng serve.


Example 1:


<!doctype html>
<html lang="en">
    <meta charset="utf-8">
    <base href="/">
    <meta name="viewport" content=
        "width=device-width, initial-scale=1">
    <link href=
    <link rel="icon" type="image/x-icon" 
    <link rel="preconnect" 
    <link href=
    <link href=
<body class="mat-typography">


<pre id='gfg1' class="card 
    card-block card-header mb-3">
    Model: {{gfg | json}}
<input [(ngModel)]="gfg" 


import { NgModule } from '@angular/core';
// Importing forms module
import { FormsModule,
ReactiveFormsModule  } 
from '@angular/forms';
import { BrowserModule } 
from '@angular/platform-browser';
import { BrowserAnimationsModule } 
from '@angular/platform-browser/animations';
import { TypeaheadModule} 
from 'ngx-bootstrap/typeahead';
import { AppComponent } 
from './app.component';
  bootstrap: [
  declarations: [
  imports: [
export class AppModule { }


#gfg1 {
    margin: 10px;


import { Component, OnInit, LOCALE_ID } 
from '@angular/core';
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
export class AppComponent {
    'gfg': string;
    geeks: string[] = [


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!