ngx-select2
v0.3.0
Published
Select2 component for Angular
Downloads
3,255
Readme
ngx-select2
Select2 component for Angular
Usage
- Add
jQuery
andSelect2
lib
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
- Install
ngx-select2
npm i ngx-select2
- Use select2 component
import { LSelect2Module } from 'ngx-select2';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
LSelect2Module
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
<l-select2 [(ngModel)]="selected" [data]="data" [options]="options" [disabled]="false" (valueChange)="valueChange($event)"></l-select2>
Options
- data: select2 init data for select
- options: select2 options
- disabled: disable select2 component
- valueChange:
output
. Fire on value change, same asngModelChange
ChangeLog
0.2.0
: AddvalueChange
, SupportAngular 6
0.3.0
: SupportAngular 9