You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

ngx-google-location-autocomplete

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-google-location-autocomplete

An Angular library that integrates Google Places API to provide location-based autocomplete functionality.

1.1.0
latest
Source
npmnpm
Version published
Weekly downloads
29
7.41%
Maintainers
1
Weekly downloads
 
Created
Source

ngx-google-location-autocomplete

An Angular library that integrates the Google Places API to provide location-based autocomplete functionality. Easily add address suggestions with full place details using customizable, lightweight, and developer-friendly directives/components.

Installation

npm

npm install ngx-google-location-autocomplete

yarn

yarn add ngx-google-location-autocomplete

Demo

Watch the demo

Integration

  • Add google library in your index.html file :
    <script src="https://maps.googleapis.com/maps/api/js?key=<Your API KEY>&libraries=places&language=en"></script>
  • Replace with google places api key. Ref - https://developers.google.com/places/web-service/get-api-key

Usage

  • Add the directive to the component where you want to use it.
import { NgxGoogleLocationAutocompleteDirective } from 'ngx-google-location-autocomplete';

@Component({
  standalone: true,
  imports: [NgxGoogleLocationAutocompleteDirective]
  ...
})
  • Add directive ngx-google-location-autocomplete to your input field (options is an optional parammeter)
<input ngx-google-location-autocomplete [options]='options' #placesRef="ngx-location" (onAddressChange)="handleAddressChange($event)"/>
  • Additionally you can reference directive in your component
    @ViewChild("placesRef") placesRef : NgxGoogleLocationAutocompleteDirective;

        public handleAddressChange(address: Address) {
        // Do some stuff
    }

Options

Refer to original google maps api - https://developers.google.com/maps/documentation/javascript/places-autocomplete Options object - https://github.com/skynet2/ngx-google-location-autocomplete/blob/master/src/objects/options/options.ts Google doc for Options : https://developers.google.com/maps/documentation/javascript/reference/places-widget#AutocompleteOptions Example :

[options]="{ types: [], componentRestrictions: { country: 'UA' } }"

Keywords

angular

FAQs

Package last updated on 26 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts