Reference to postcode lookup button
Ideal Postcodes API client
HTML Element in which postcode lookup tools live
Cache for recently retrieved data
Reference to the DOM, to which this.scope belongs
Reference to postcode lookup input field
Stores most recent lookup
Reference to message paragraph element
Caches options object
Scopes the DOM for fields which should receive address inputs
Scopes the DOM for the entire controller
Reference to dropdown containing address suggestions
Reference to HTMLElement that wraps the
Clickable element that triggers unhiding of address fields if enabled
Creates Select HTML Element
Creates a clickable element that can trigger unhiding of fields
Prevents lookup button from being triggered
Enables lookup button to trigger searches
Allows lookup button to be triggered and applies a cooloff timer if configured
Triggers a search based on term and mounts addresses to DOM in the address dropdown
Validate search term and then trigger postcode lookup
Hides fields marked for hiding
Hides any messages
Call to initially render the DOM elements
This will perform an optional keyCheck if required
Mounts dropdown menu to DOM and attach event listeners
Removes dropdown from DOM if data is undefined
Writes a selected to the input fields specified in the controller config
Removes all elements from DOM including dropdown, input, button and any error message
Empties context and appends postcode lookup input, button, message field and select container
Does not render element if a custom element has been provided
Resets address search fields
Selects an address by its offset i
in the list of address results
Sets the error message
Removes error message from DOM if undefined
Unhides fields marked for hiding and triggers callback
unmountButton
Removes select container from DOM
Removes address input artefacts from DOM
Removes message container from DOM
Remove dropdown from DOM
Removes unhide elem from DOM
A Postcode Lookup Controller instances manages the state of a postcode or address search widget and updates the DOM accordingly
To detach from the DOM call use the
#removeAll()
method