Socket
Socket
Sign inDemoInstall

ngx-google-places-autocomplete

Package Overview
Dependencies
4
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ngx-google-places-autocomplete

This module is a wrapper for Google Places Autocomplete js library.


Version published
Weekly downloads
17K
decreased by-16.27%
Maintainers
1
Install size
30.9 kB
Created
Weekly downloads
 

Readme

Source

ngx-google-places-autocomplete

This module is a wrapper for Google Places Autocomplete js library.

NPM

Installation

npm
npm install ngx-google-places-autocomplete
yarn
yarn add ngx-google-places-autocomplete

Integration

  1. 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>
  1. Replace with google places api key. Ref - https://developers.google.com/places/web-service/get-api-key

Usage

  1. Add a module into your application (as a rule app.module.ts)
import { GooglePlaceModule } from "ngx-google-places-autocomplete";

@NgModule({
    imports: [GooglePlaceModule, BrowserModule, FormsModule, ...],
        ....
        })
  1. Add directive ngx-google-places-autocomplete to your input field (options is an optional parammeter)
<input ngx-google-places-autocomplete [options]='options' #placesRef="ngx-places" (onAddressChange)="handleAddressChange($event)"/>
  1. Additionally you can reference directive in your component
    @ViewChild("placesRef") placesRef : GooglePlaceDirective;
    
        public handleAddressChange(address: Address) {
        // Do some stuff
    }

Angular Universal

In order to use under angular universal please check that comment https://github.com/skynet2/ngx-google-places-autocomplete/issues/15#issuecomment-465371214

Options

Refer to original google maps api - https://developers.google.com/maps/documentation/javascript/places-autocomplete Options object - https://github.com/skynet2/ngx-google-places-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' }
    }"

GitHub

Please feel free to declare issues or contribute: https://github.com/skynet2/ngx-google-places-autocomplete

Keywords

FAQs

Last updated on 03 Nov 2020

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc