Git Product home page Git Product logo

angularmaterialautocomplete's Introduction

Angular Material AutoComplete and ChipsAutoComplete

This are custom angular material components, you still need to add angular material module to your application for this to work, also remember to add the ValidationService into your app or shared module.

How to use:

app.module or shared.module

import { AngularMaterialsModule } from './angular-materials-module';

@NgModule({
  declarations: [
    AutoCompleteComponent,
    ChipsComponent
  ],
  imports: [CommonModule, AngularMaterialsModule],
  exports: [
    AngularMaterialsModule,
    AutoCompleteComponent,
    ChipsComponent
  ],
  providers: [ValidationService]
})
export class SharedModule {}

AutoCompleteComponent

attributes you can use :

  • control: this is the control of your form.

  • options: array of elements to use as options, they have to be in the following format :

[
  {
    label: 'text you want to show to the user',
    value: 'the value you want when selecting the option'
  }
]
  • placeholder: text that you want to show at your input.

  • selectionChange: method you want to call when making changes to your control.

  • disabled: can be true or false.

  • required: can be true or false.

Example:

<app-auto-complete
  [control]="form.get('yourControl')"
  [options]="options"
  placeholder="this is a placeholder"
  [required]="true"
>
</app-auto-complete>

ChipsComponent

attributes you can use :

  • control: this is the control of your form.

  • allOptions: array of elements to use as options, they have to be in the following format :

[
  'the value you want when selecting the option',
  'the value you want when selecting the option 2',
  'the value you want when selecting the option 3'
]
  • placeholder: text that you want to show at your input.

  • selectable: whether or not this chip list is selectable. When a chip list is not selectable, the selected states for all the chips inside the chip list are always ignored.

  • removable: determines whether or not the chip displays the remove styling and emits (removed) events.

  • addOnBlur: whether or not the chipEnd event will be emitted when the input is blurred.

  • onlyListItems: the user can only choose from the auto complete, this way you can manage what things can be added as chips. required: can be true or false.

Example:

<app-chips
  placeholder="this is a placeholder"
  [control]="form.get('yourControl')"
  [allOptions]="moviles"
></app-chips>

You can use the chips component without options ! this way you can add what ever you want as chips :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.