0.0.14 • Published 3 years ago

ng-multi-select-library v0.0.14

Weekly downloads
428
License
-
Repository
-
Last release
3 years ago

NgMultiSelect

Demo

demo

Features

  • dropdown with single/multiple selction option
  • bind to any data source
  • search item with custom placeholder text

Installation

npm i ng-multi-select-library

And then include it in your module :

import { NgMultiSelectModule } from 'ng-multi-select-library';
// ...

@NgModule({
  imports: [
    NgMultiSelectModule.forRoot()
    // ...
  ]
  // ...
})
export class AppModule {}

Usage

import { Component, OnInit } from '@angular/core';
import { IDropdownSettings } from 'ng-multiselect-dropdown';

export class AppComponent implements OnInit {

  selected = [];

  data = [
    {
      name: "Steve Jobs",
      id: "1"
    },
    {
      name: "Bill Gates",
      id: "2"
    },
    {
      name: "Mark Zuckerberg",
      id: "3"
    },
    {
      name: "Jack Dorsey",
      id: "4"
    }

  ]


  onChangeInArray(data) {
    console.log("app component data ", data);
  }
}
<lib-ng-multiselect
  [options]="data" optionLabel="name"
  optionValue="id"
  (onChange)="onChangeInArray($event)"
  [filter]="true"
  filterBy="name"
  [(ngModel)]="selected">
</lib-ng-multiselect>
<lib-ng-multiselect
  [options]="data" optionLabel="name"
  optionValue="id"
  (onChange)="onChangeInArray($event)"
  [filter]="true"
  filterBy="name"
  formControlName="control">
</lib-ng-multiselect>

Settings

NameTypeDescriptionDefault Value
optionsArrayAn array of objects to display as the available options.[]
optionLabelStringName of the label field of an option to display in dropdown.
optionValueStringName of the value field to bind which would be considered as the selected value.false
filterbooleanWhen this option is set to true, then the filter input would be visible in the dropdown.
filterBybooleanWhen filtering is enabled, filterBy option will decide which field or fields to lookup while the user is searching.

Callback Methods

  • onChange - Return the selected items when an item is checked or unchecked. Example : (onChange)="onChangeInArray($event)"
0.0.12

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.0

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago