npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

hls-address

v0.0.0-watch

Published

![Angular](https://img.shields.io/badge/Angular-DD0031?style=for-the-badge&logo=angular&logoColor=white) ![Material Design](https://img.shields.io/badge/Material%20Design-757575?style=for-the-badge&logo=material-design&logoColor=white)

Readme

Address Autocomplete Component

Angular Material Design

An Angular Material component for address autocomplete using the Geoapify API.


Features

  • ✅ Angular 18+ support (standalone or module-based)
  • 🎨 Material Design UI with auto-complete
  • 🌍 Geoapify integration for location-based suggestions
  • 📦 Reactive Forms and standalone output support

Setup

📥 Installation

npm install hls-address

⚠️ Requirements

To properly use this library in your Angular application, ensure the following:

  • ✅ You're using Angular 18 or higher.
  • ✅ You've installed @angular/material and set up a theme (required for styling).
  • ✅ You handle errors from the Geoapify service (e.g., API limits, network failures) using a global HttpInterceptor.
  • ✅ You provide HttpClient using provideHttpClient().

⚠️ Note for Angular 18 users:
If you're using Angular 18 and encounter an animation error (e.g., NG05105), make sure to:

  • Import BrowserAnimationsModule in your AppModule (for module-based apps), or
  • Add provideAnimations() to your provider list (for standalone apps).

This ensures compatibility with Angular Material animations like those used in autocomplete.


Basic Implementation

Provide the ADDRESS_AUTOCOMPLETE_CONFIG token with your Geoapify API key and optional configuration, either in your module or in bootstrapApplication() for standalone apps:

import { provideHttpClient } from '@angular/common/http';
import { ADDRESS_AUTOCOMPLETE_CONFIG } from 'hls-address';

bootstrapApplication(AppComponent, {
  providers: [
    provideHttpClient(),
    {
      provide: ADDRESS_AUTOCOMPLETE_CONFIG,
      useValue: {
        apiKey: 'your_geoapify_key',  // Required
        countryCode: 'us',            // Optional
        type: 'street',               // Optional
        limit: 5,                     // Optional
        lang: 'en',                   // Optional
        bias: 'proximity:lng,lat'  // Optional
      }
    }
  ]
});

Importing the Component

Import AddressAutocompleteComponent into your module or standalone component:

import { AddressAutocompleteComponent } from 'hls-address';

Module-based App

@NgModule({
  imports: [
    // ... other imports
    AddressAutocompleteComponent
  ]
})
export class YourModule {}

Standalone Component

@Component({
  imports: [
    // ... other imports
    AddressAutocompleteComponent
  ]
})
export class YourComponent {}

Using with Reactive Forms (formControlName)

Use the component with FormControl<Address | null> for full type safety.

Component Class

import { Address } from 'hls-address';
import { FormControl, FormGroup } from '@angular/forms';

...

this.form = new FormGroup({
  address: new FormControl<Address | null>(null),
});

Template

<form [formGroup]="form">
  <hls-address-autocomplete
    [label]="'Address'"
    [placeholder]="'Search for an address...'"
    formControlName="address"
  ></hls-address-autocomplete>
</form>

Without Reactive Forms (onAddressSelected Output)

If you're not using Reactive Forms, you can handle address selections via the output event.

Template

<hls-address-autocomplete
  [label]="'Address'"
  [placeholder]="'Search for an address...'"
  (onAddressSelected)="handleAddressSelection($event)"
></hls-address-autocomplete>

Component Class

handleAddressSelection(address: Address) {
  console.log('Selected address:', address);
}

Notes:

  • You can use both formControlName and onAddressSelected at the same time.
  • To disable the address autocomplete field, use a disabled FormControl as follows:
new FormControl({ value: null, disabled: true })

Do not use the [disabled] template binding.


⚙️ Configuration Options

| Parameter | Type | Default | Description | |---------------|----------|-----------|-------------------------------------------------------------------------------------------------| | apiKey | string | — | Required. Your Geoapify API key. | | countryCode | string | 'us' | ISO 3166-1 alpha-2 country code(s). Can be a single code or multiple separated by commas. | | type | string | 'street'| Restrict results by location type. Valid values: 'country', 'state', 'city', 'postcode', 'street', 'amenity', 'locality'. | | limit | number | 5 | Maximum number of suggestions to return. | | lang | string | 'en' | 2-letter ISO 639-1 language code for localized results. | | bias | string | — | Bias results toward a specific location. Example: proximity:-122.53,37.95 |

💡 Note: Refer to the Geoapify Geocoding API documentation for updated usage details and advanced examples.


Component API

Inputs

| Name | Type | Default | Description | |---------------|--------------------------|---------------------|-------------------------------------------------------------------------------------| | label | string | 'Address' | Label text displayed above the input field. | | placeholder | string | 'Enter address...'| Placeholder text inside the input. | | appearance | MatFormFieldAppearance | 'outline' | Material appearance style: 'fill' or 'outline'. |

Output

| Name | Type | Description | |-------------------|-------------------------|--------------------------------------------------------------| | addressSelected | EventEmitter<Address> | Emits the full selected address object when an option is chosen. |