Skip to content

hflabs/suggestions-js

Repository files navigation

Build Status GitHub all releases npm

DaData.ru Suggestions plugin

===

JavaScript plugin for DaData.ru Suggestions service.

Installation

npm install @dadata/suggestions

Basic Usage

import { init, dispose } from '@dadata/suggestions';

// ...
// when you need to initialize Suggestions on some input

const addressInput: HTMLInputElement = document.getElementById(...);
const disposeSuggestions = init(addressInput, { type: 'address' });

// ...
// if you need to remove the Suggestions from the input
// use callback returned from `init()`

disposeSuggestions();

// or just
dispose(addressInput);

Files in this package

  • lib/findById.js -- basic search without ui
  • lib/findById.ie.js -- same, but built with polyfills
  • lib/suggest.js (default) -- search with auto-complete ui
  • lib/suggest.ie.js -- same, but built with polyfills