Options
All
  • Public
  • Public/Protected
  • All
Menu

The Autocomplete Controller class acts as the public class which you may wield to enable address autocomplete on your HTML address forms

When instantiated, the controller will serve as a bridge beteen the address suggestion view presented on the DOM and the Ideal Postcodes Address resolution HTTP APIs

More concretely, the instantiation of a controller instance creates:

The role of the controller is to bind to events produced by the user interface and take appropriate action including querying the API, modifying other aspects of the DOM.

Hierarchy

  • Controller

Index

Constructors

constructor

Properties

cache

cache: ApiCache

Address Finder API cache

client

client: Client

Ideal Postcodes API Client

document

document: Document

Reference to the DOM, to which this.scope belongs

options

options: StoredOptions

Caches options

outputScope

outputScope: HTMLElement | Document

Scopes the DOM for fields which should receive address inputs

scope

scope: HTMLElement | Document

Scopes the DOM for the entire controller

view

view: View

View instance

Methods

init

  • init(): Promise<void>
  • Attaches Controller to the DOM.

    If checkKey is enabled, a key check will be performed prioer to binding. Use the onLoaded and onFailedCheck callbacks to define follow up behaviour if the key check succeeds or fails

    Returns Promise<void>

populateAddress

  • populateAddress(address: Address): void
  • Writes a selected to the input fields specified in the controller config

    Parameters

    • address: Address

    Returns void