New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
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 dropdown menu. You can provide an array of objects or an Observable array of objects

  • 3.1.3
  • npm
  • Socket score

Version published
Weekly downloads
17
decreased by-56.41%
Maintainers
1
Weekly downloads
 
Created
Source

Autocomplete-Entry

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
],

Inputs

The following Inputs are available

InputTypeDefautDescription
autocompleteBOOLEANFASLEautocomplete entry with list
dataANY[][]data for the autocomplete list or dropdown list
defaultSTRING''default selection
keySTRING''property to use for list values (object type array)
returnKeySTRING''property to use for return values (object type array)
labelSTRING''Label for input
placeholderSTRING''Label for placeholder (autocomplete input)
acceptInputBOOLEANFALSEAllow for custom entry and return value
sortAlphaBOOLEANFALSEsort in alphabetical order
requiredBOOLEANFALSEvalidation required
disabledBOOLEANFASLEdiable control
styleSTRING''styles to apply to formfield/select

FormControl

For a formControl you will need to provide control for your input

formControlName="country"

 countrySelection = this.fb.group({
    country: [null],
  })

Options

<div style="margin: 24px;" [formGroup]="selection">

  <wav-autocomplete-entry
    [autocomplete]="false"
    [data]="autocompleteList"
    [default]="'Canada'"
    [key]="'name'"
    [returnKey]="'abbr'"
    [label]="'Country'"
    [acceptInput]="true"
    [placeholder]="'Canada'"
    [sortAlpha]="true"
    [required]="true"
    [disabled]="false"
    formControlName="country"
  >
  </wav-autocomplete-entry>

</div>

Data

Provide the data ether as an Observable or Static data as an array of objects

autocompleteList = [
  { name: 'United States', id: 1, abbr: 'US'},
  { name: 'Italy', id: 1, abbr: 'IT'},
  { name: 'Canada', id: 1, abbr: 'CA'},
]

Or you can provide an array of strings

autocompleteList = ['United States', 'Italy', 'Canada']

Sample Implementation

selection: formGroup

constructor(
  private fb: FormBuilder
  ) {}

ngOnInit() {

  selection = this.fb.group({
    country: [null]
  })

  this.selection.patchValue({ country: 'Canada'})
  this.selection.valueChanges.subscribe(data => console.log(data))

  }

Keywords

FAQs

Package last updated on 20 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc