You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

autocomplete-entry

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autocomplete-entry

This Angular Component (Module) allows you to have an autocomplete or select menu. You can provide an array of objects or an Observable array of objects

1.0.1
npmnpm
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

AutocompleteEntry

This Angular Module (Component) allows you to have an autocomplete or select menu. You can provide an array of objects or an Observable array of objects. This formControl will return the selected or entered item. Blur and Enter also have been implemented.

image

Installation

npm install autocomplete-entry

Scaffolding

Import the module into your project under imports

imports: [
    BrowserModule,
    AppRoutingModule,
    AutocompleteEntryModule
  ],

Use

To use in your component, use the following tag

<app-autocomplete-selection></app-autocomplete-selection>

Inputs

Standard inputs

data STRING[] Data for autocomplete STRING[] | Observable autocomplete TRUE - Auto Filter Complete Entry FALSE - Standard Dropdown Menu BOOLEAN placeholder inside label for the input field STRING label label for the fiels STRING

Optional

required Add validation for required BOOLEAN appearance Input Field Appearance STRING (outline, filled) style Styles for input field STRING - ex: width:400px; color:red

Here is an example

<wav-autocomplete-selection
  formControlName="country"
  [data]="countries"
  [autocomplete]="true"
  [placeholder]="'Canada'"
  [label]="'Country'"
></wav-autocomplete-selection>

Here is an example with 2 autocomplete types and different options. The button will display in the console the selection whether its entered or selected.

<div [formGroup]="autoForm" style="padding: 24px;">

  <wav-autocomplete-selection
    formControlName="country1"
    [data]="countries"
    [autocomplete]="true"
    [required]="true"
    [appearance]="'outline'"
    [style]="'width:400px; color:red'"
    [placeholder]="'Canada'"
    [label]="'Country'"
  ></wav-autocomplete-selection>

  <wav-autocomplete-selection
    formControlName="country2"
    [data]="countries"
    [autocomplete]="false"
    [required]="false"
    [appearance]="'outline'"
    [style]="'width:400px; color:red'"
    [placeholder]="'Canada'"
    [label]="'Country'"
  ></wav-autocomplete-selection>

  <button mat-button (click)="onSubmit()">Submit</button>

</div>

In the component we define the menu's contents and define the form

countries = ['Canada', 'United States', 'Russia', 'China']
country = ''

autoForm = this.fb.group({
  country1: [null], country2: [null]
})

The onSubmit action connectd to the button click event

onSubmit() {
  this.autoForm.markAllAsTouched()
  if(this.autoForm.valid) console.log('valid:',this.autoForm.value)
  console.log(this.autoForm.value, this.autoForm.valid)
}

Keywords

angular

FAQs

Package last updated on 01 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts