Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngx-autocom-place

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-autocom-place

Angular GoogleMaps Places Api Autocomplete Directive

  • 4.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
241
decreased by-6.23%
Maintainers
1
Weekly downloads
 
Created
Source

ngxAutocomPlace : Angular Google Places API Autocomplete Directive

Add this directive to any input to activate the google places autocomplete feature.
It uses google place API programmatically instead of the ready to use autocomplete javascript widget provided by google. This allows to handle keydown.enter events to select the first result automatically, and access the predictions for further customisations.

Tested with :

FramworkVersion
Angular8 +
Ionic4 +

Install

    npm i --save ngx-autocom-place

import NgxAutocomPlaceModule in your app module.

  • Add this to index.html
      <script src="https://maps.googleapis.com/maps/api/js?key=<YourApiKey>&libraries=places&language=en"></script>

Usage

    <input type="text" ngxAutocomPlace (selectedPlace)="placeChangedCallback($event)"/>
  • attribute [options] (optional) can be added to pass (ref: https://developers.google.com/maps/documentation/javascript/reference/places-widget)

Api

ngxAutocomPlace

[options]

Use to customise the autocomplete options. (optional) Default to :

{
    types: ["geocode"]
}

Format : https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#AutocompletionRequest

(selectedPlace)

Emit selected place result.
Format : https://developers.google.com/maps/documentation/javascript/reference/places-service#PlaceResult

(predictions)

Emit predictions on user input. (optional) Format : https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#AutocompletePrediction

[handleEnterKeydown]

Set handler for enter key press event by user with first result selection from google predictions dropdown. (optional) Default: True

[hideResultDropdown]

Set to true to not display the result dorpdown and handle predictions by your own. (optional) Default: False

[debounceTime]

Time to delay each input event (rxjs debounceTime) (optional) Default: 150 (ms)

NgxAutocomPlaceService

getPredictions

getPlacePrediction implementation : https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#AutocompleteService.getPlacePredictions

getPlaceDetails

getDetails implementation : https://developers.google.com/maps/documentation/javascript/reference/places-service#PlacesService.getDetails

Keywords

FAQs

Package last updated on 03 Apr 2022

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc