1.1.4 • Published 6 years ago

angular-select2-component v1.1.4

Weekly downloads
218
License
MIT
Repository
github
Last release
6 years ago

Angular-Select2-Component

Related Versions

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

How to use


Install

// npm install
npm install angular-select2-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-component';

@NgModule({
  // ...
  // declare components
  declarations: [Select2Component]
})
export class YourModule {
}
  1. Template.
<select2 [options]="options" [settings]="{ setting: value }" [(ngModel)]="optionSelected" (onSelect)="onSelect($event)"></select2>
  1. Compile settings.

If you have set the include or exclude option in your tsconfig.json, you need to include the node_modules/angular-select2-component/index.ts file.

// tsconfig.json
{
  "include": [
    "node_modules/angular-select2-component/index.ts"
  ]
}

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 }
1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago