angular-select2-js-component
TypeScript icon, indicating that this package has built-in type declarations

1.1.11 • Public • Published

Angular-Select2-JS-Component

Related Versions

Angular-Select2-Component is based on these plugins and libs(version):

How to use


Install

// npm install
npm install angular-select2-js-component --save
 
// if you have not installed jquery
npm install jquery --save

Use as component

  1. Import component.
// import NgModule
import {NgModule} from '@angular/core';
// import Select2Component
import {Select2Component} from 'angular-select2-js-component';
 
@NgModule({
  // ...
  // declare components
  declarations: [Select2Component]
})
export class YourModule {
}
  1. Template.
<select2 [options]="options" [settings]="{ setting: value }" [(ngModel)]="optionSelected" (onSelect)="onSelect($event)"></select2>

Options

  • options: option[]
    • select options for select2
    • option: {id: value, text: key} or string
  • ngModel: option value that is selected
    • id or string while multiple is disable
    • id[] or string[] while multiple is enable
  • onSelect
    • callback when option selected
    • parmas: option({id: value, text: key, selected: ifSelected} or string)
  • settings
    • configurable settings, see Select2 options API
    • setting: { settingOption: value, settingOption: value }

Package Sidebar

Install

npm i angular-select2-js-component

Weekly Downloads

1

Version

1.1.11

License

MIT

Unpacked Size

465 kB

Total Files

19

Last publish

Collaborators

  • markbradshaw