@@ -64,7 +64,7 @@ export class NgSelect2Component implements AfterViewInit, OnChanges, OnDestroy,
6464 @Input ( ) options : Options ;
6565
6666 // emitter when value is changed
67- @Output ( ) valueChanged = new EventEmitter ( ) ;
67+ @Output ( ) valueChanged = new EventEmitter < string | string [ ] > ( ) ;
6868
6969 private element : any = undefined ;
7070 private check = false ;
@@ -104,6 +104,7 @@ export class NgSelect2Component implements AfterViewInit, OnChanges, OnDestroy,
104104
105105 const newValue : string | string [ ] = this . value ;
106106 this . setElementValue ( newValue ) ;
107+ this . valueChanged . emit ( newValue ) ;
107108 this . propagateChange ( newValue ) ;
108109 }
109110
@@ -112,6 +113,7 @@ export class NgSelect2Component implements AfterViewInit, OnChanges, OnDestroy,
112113 const newValue : string = changes [ 'value' ] . currentValue ;
113114
114115 this . setElementValue ( newValue ) ;
116+ this . valueChanged . emit ( newValue ) ;
115117 this . propagateChange ( newValue ) ;
116118 }
117119
@@ -148,8 +150,8 @@ export class NgSelect2Component implements AfterViewInit, OnChanges, OnDestroy,
148150 // const newValue: string = (e.type === 'select2:unselect') ? '' : this.element.val();
149151 const newValue = this . element . val ( ) ;
150152
153+ this . valueChanged . emit ( newValue ) ;
151154 this . propagateChange ( newValue ) ;
152- this . setElementValue ( newValue ) ;
153155 } ) ;
154156 }
155157
@@ -236,11 +238,10 @@ export class NgSelect2Component implements AfterViewInit, OnChanges, OnDestroy,
236238 }
237239 }
238240
239- propagateChange = ( value : any ) => { } ;
241+ propagateChange = ( value : string | string [ ] ) => { } ;
240242
241243 registerOnChange ( fn : any ) {
242244 this . propagateChange = fn ;
243- this . valueChanged . subscribe ( fn ) ;
244245 }
245246
246247 registerOnTouched ( ) {
0 commit comments