Typeahead Component

#### Typeahead:

The typeahead component can be used to quickly create elegant typeaheads with any form text input.

#### Typeahead Example:

##### Static arrays

    Model: {{selected | json}}

##### Asynchronous results

    Model: {{asyncSelected | json}}

No Results Found

#### Example code:

               // Typeahead example template
               <h5>Static arrays</h5>
               <pre class="card card-block card-header">Model: { {selected | json} }</pre>
               <input [(ngModel)]="selected"
                         [typeahead]="statesComplex"
                         (typeaheadOnSelect)="typeaheadOnSelect($event)"
                         [typeaheadOptionField]="'name'"
                         class="form-control"/>

               <h5>Asynchronous results</h5>
               <pre class="card card-block card-header">Model: { {asyncSelected | json} }</pre>
               <input [(ngModel)]="asyncSelected"
                         [typeahead]="getAsyncData(getContext())"
                         (typeaheadLoading)="changeTypeaheadLoading($event)"
                         (typeaheadNoResults)="changeTypeaheadNoResults($event)"
                         (typeaheadOnSelect)="typeaheadOnSelect($event)"
                         [typeaheadOptionsLimit]="7"
                         placeholder="Locations loaded with timeout"
                         class="form-control"/>

#### Typeahead properties:

- `ngModel` (`string`) - binds to string user's input
- `typeahead` (`any`) - options source, can be Array of strings or objects or function that return Promise for external matching process
- `typeaheadMinLength` (`?number=1`) - minimal no of characters that needs to be entered before typeahead kicks-in. When set to 0, typeahead shows on focus with full list of options (limited as normal by typeaheadOptionsLimit)
- `typeaheadWaitMs` (`?number=0`) - minimal wait time after last character typed before typeahead kicks-in
- `typeaheadOptionsLimit` (`?number=20`) - maximum length of options items list
- `typeaheadOptionField` (`?string`) - name of field in array of states that contain options as objects, we use array item as option in case of this field is missing
- `typeaheadAsync` (`?boolean`) - should be used only in case of `typeahead` attribute is array. If `true` - loading of options will be async, otherwise - sync. `true` make sense if options array is large.
- `typeaheadLatinize` (`?boolean=true`) - match latin symbols. If `true` the word `súper` would match `super` and vice versa.
- `typeaheadSingleWords` (`?boolean=true`) - break words with spaces. If `true` the text `"exact phrase" here match` would match with `match exact phrase here` but not with `phrase here exact match` (kind of "google style").
- `typeaheadWordDelimiters` (`?string=" "`) - should be used only in case `typeaheadSingleWords` attribute is `true`. Sets the word delimiter to break words. Defaults to space.
- `typeaheadPhraseDelimiters` (`?string="'\""`) - should be used only in case `typeaheadSingleWords` attribute is `true`. Sets the word delimiter to match exact phrase. Defaults to simple and double quotes.
- `typeaheadAppendToBody` (not implemented) (`?boolean=false`) - if `true` the typeahead popup will be appended to $body instead of the parent element
- `typeaheadEditable` (not implemented) (`?boolean=true`) - if `false` restrict model values to the ones selected from the popup only will be provided
- `typeaheadFocusFirst` (not implemented) (`?boolean=true`) - if `false` the first match automatically will not be focused as you type
- `typeaheadInputFormatter` (not implemented) (`?any`) - format the ng-model result after selection
- `typeaheadSelectOnExact` (not implemented) (`?boolean=false`) - if `true` automatically select an item when there is one option that exactly matches the user input
- `typeaheadSelectOnBlur` (not implemented) (`?boolean=false`) - if `true` select the currently highlighted match on blur
- `typeaheadFocusOnSelect` (not implemented) (`?boolean=true`) - if `false` don't focus the input element the typeahead directive is associated with on selection

#### Typeahead events

- `typeaheadLoading` - fired when 'busy' state of this component was changed, fired on `async` mode only, returns `boolean`
- `typeaheadNoResults` - fired on every key event and returns `true` in case of matches are not detected
- `typeaheadOnSelect` - fired when option was selected, return object with data of this option