ng-simple-typeahead
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

Typeahead

Usage

Add the following in your html

<lib-selection-typeahead [items]="items" [placeholder]="placeholder" [typeAheadConfig]="typeAheadConfig" [ngStyle]="ngStyle" (setValue)="onSetValue($event)"></lib-selection-typeahead>

Add the following instance attribute in your ...component.ts

  public items: string[] = this.getItems();
  public placeholder = 'What are you looking for?';
  public ngStyle = this.getStyling();
  public typeAheadConfig: ITypeAheadConfig = this.getTypeAheadConfig();

  private getStyling(): any {
    // whatever your style is ... :)
    return {
      'background-color': 'white',
      color: 'black'
    };
  }

  private getItems(): string[] {
    // whatever your items are ... :)
    const models: string[] = [];
    models.push('Alpha');
    models.push('Porsche');
    models.push('Tesla');
    return models;
  }

  private getTypeAheadConfig(): ITypeAheadConfig {
    return {
      debounceTimeInMilliSeconds: 200,
      showAfterXLetters: 1,
      maxAmountOfDisplayedItems: 10
    };
  }

  public onSetValue(value: string) {
    alert(value);
  }

Add the following in your app.module.ts

  import { SelectionTypeaheadModule } from 'ng-simple-typeahead';

  imports: [
    SelectionTypeaheadModule,

Readme

Keywords

none

Package Sidebar

Install

npm i ng-simple-typeahead

Weekly Downloads

1

Version

0.1.1

License

GNU GPL

Unpacked Size

103 kB

Total Files

29

Last publish

Collaborators

  • danceplanner