Skip to main content

Posts

Showing posts with the label autocomplete input text

Angular 5 Autocomplete Input-Text and Options

The autocomplete is a normal text input extended by a panel of suggested options i.e. autocomplete.html – < form class = "class-form" >   < mat-form-field class = "class-full-width" >     < input type = "text" placeholder = "Select a user" aria-label = "Number" matInput [ formControl ]= "myControl" [ matAutocomplete ]= "auto" >     < mat-autocomplete # auto = "matAutocomplete" >       < mat-option * ngFor = "let user of users" [ value ]= "user" >         {{ user }}       </ mat-option >     </ mat-autocomplete >   </ mat-form-field > </ form > And autocomplete.ts – import { Component } from '@angular/core' ; import { FormControl } from '@angular/forms' ; /** Simple autocomplete */ @ Component ({   selector: 'autocomplete' ,   te...