/* Copyright © 2016-2019 Lidor Systems. All rights reserved. This file is part of the "IntegralUI Web" Library. The contents of this file are subject to the IntegralUI Web License, and may not be used except in compliance with the License. A copy of the License should have been installed in the product's root installation directory or it can be found at http://www.lidorsystems.com/products/web/studio/license-agreement.aspx. This SOFTWARE is provided "AS IS", WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. Any infringement will be prosecuted under applicable laws. */ import { Component, ViewContainerRef, ViewChild, ViewChildren, ViewEncapsulation } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs'; @Component({ selector: '', template: `

AutoComplete / Overview

IntegralUI AutoComplete is a native Angular component that represents a text box with a dropdown list where you can choose among suggested options. You can modify the component appearance via CSS.

In this example, whenever you enter a text a list will popup showing city names that match the entered text. You can navigate through the list using keyboard and choose an option either by pressing the ENTER key, mouse button or touch. The list is loaded from a JSON file and sorted in ascending order.

The following properties and events are supported:

For more information check out the source code of this sample (autocomplete/autocomplete-overview.ts) file.

`, encapsulation: ViewEncapsulation.None }) export class AutoCompleteOverviewSample { @ViewChild('application', {read: ViewContainerRef, static: false}) applicationRef: ViewContainerRef; public ctrlStyle: any = { general: { normal: 'atcmplt-ovw', } } public dataFields: any = { text: 'name' } public sampleList: Array = []; public textValue: string = ''; constructor(private http: HttpClient){} ngAfterViewInit(){ // Load data into the ListBox from a JSON file this.loadFromJSON(); } private loadFromJSON(){ let self = this; // Use HTTP service to get data from the specified JSON file self.http.get("./assets/cities.json").subscribe((data: Array) => self.sampleList = data); } onValueChanged(e: any){ console.log("Text value changes to: ", e.value); } }