Ionic 5 Full Starter App
  • Enappd Apps
  • Ionic 5 Full App
    • What is Ionic 5 Full App?
    • Template Features
    • Initial Setup
      • Environment Configuration
      • Credentials
    • Running the app
    • Deploying app as PWA
    • Building App on device
    • How to use this template?
      • Copy a module to another app
      • Shared Component & Modules
      • Map Service
    • Beginner Pack Features
      • Firebase
      • Layouts
      • Sidemenus
      • Login and Signups
      • Chat screens
      • Chat Lists
      • Video Playlists
      • Grids and Lists Layouts
    • Startup Pack Features
      • Wordpress
        • Wordpress JSON API Basics
        • Wordpress in Ionic 5 Full App
      • Translation - Multi-language
      • Using Custom Fonts
      • Infinite scroll
      • Content Loaders
      • Pull to refresh
      • List re-ordering
      • Date Pickers
    • Pro Pack Features
      • Phaser Game Framework
      • AdMob Integration
        • AdMob Introduction
        • Setting up Google Admob
        • Integration
      • Social Sharing
      • QR and Barcode Scanning
      • Google Places
      • Google Autocomplete
      • Social Logins
        • Google Login
        • Facebook Login
        • Twitter Login
      • Woo-commerce Integration
    • Removing a Page / Component
    • Removing a plugin
    • FAQs
    • Changelog
    • Troubleshoot
Powered by GitBook
On this page

Was this helpful?

  1. Ionic 5 Full App
  2. Pro Pack Features

Google Autocomplete

Implement a search bar with autocomplete functionality that matches places catalogued by Google

PreviousGoogle PlacesNextSocial Logins

Last updated 5 years ago

Was this helpful?

Autocomplete is used in various apps for finding locations on a map . E.g. We use autocomplete in Uber to find our destination, to find a place on Google Maps etc.

Ionic 5 Full App implements autocomplete using AGM - Angular google Maps.

Import the MapsAPILoader with

import { MapsAPILoader } from '@agm/core';

Autocomplete can be simply implemented using

const autocomplete = new google.maps.places.Autocomplete(nativeHomeInputBox, {
  types: ['address']
});
autocomplete.addListener('place_changed', () => {
  this.ngZone.run(() => {
    const place: google.maps.places.PlaceResult = autocomplete.getPlace();
    this.query = place['formatted_address'];
  });
});

Once a place is selected from the list, place variable in the above function return a response as shown below. You can choose formatted_address for all general purposes.

Autocomplete in Ionic 5 Full App