🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

google-maps-autocomplete-input

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-maps-autocomplete-input

_autocomplete input with dropdown for google maps JS API

0.1.1
Source
npm
Version published
Weekly downloads
12
9.09%
Maintainers
1
Weekly downloads
 
Created
Source

Autocomplete input with dropdwon for google maps JS API · npm version

Sample

Installation

Node

npm i -s google-maps-autocomplete-input 

Script tag

<script src="./node_modules/google-maps-autocomplete-input/google-maps-autocomplete-input.min.js"></script>

Usage

  // _init module, you need API_TOKEN from google console
  const gmaInput = new googleMapsAutocompleteInput('<API_TOKEN>');
  const cityConfig = {
    // _specify country for autocomplete
    countryCode: 'us',
    // _type of autocomplition: (cities), (regions): https://developers.google.com/maps/documentation/javascript/places-autocomplete
    autocompleteType: ['(cities)'],
    // _use only place name
    onlyName: true,
    // _inputs list with additional filter places like city, state, country
    filterInputs: []
  } 
  // _after dropdown selected callback
  const afterCitySelected = place_id => {
    console.log(place_id);
  }
  
  const cityInput = document.getElementById('dcity');
  // bind input with autocompletetion to input
  gmaInput.bindInput({
      input: cityInput, 
      config: cityConfig,
      afterSelected: afterCitySelected
  });

License

Autocomplete input with dropdwon is MIT licensed.

Keywords

front-end

FAQs

Package last updated on 26 May 2020

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