@@ -357,7 +357,6 @@ export class Dropdown implements OnInit, AfterContentInit, AfterViewInit, OnDest
357357 protected elementRef : ElementRef ,
358358 protected i18n : I18n ,
359359 protected dropdownService : DropdownService ,
360- protected ngZone : NgZone ,
361360 protected elementService : ElementService ) { }
362361
363362 /**
@@ -387,36 +386,34 @@ export class Dropdown implements OnInit, AfterContentInit, AfterViewInit, OnDest
387386 const isUpdate = event => event && event . isUpdate ;
388387
389388 this . view . select . subscribe ( event => {
390- this . ngZone . run ( ( ) => {
391- if ( this . type === "single" && ! isUpdate ( event ) ) {
392- this . closeMenu ( ) ;
393- if ( event . item && event . item . selected ) {
394- if ( this . itemValueKey ) {
395- this . propagateChange ( event . item [ this . itemValueKey ] ) ;
396- } else {
397- this . propagateChange ( event . item ) ;
398- }
389+ if ( this . type === "single" && ! isUpdate ( event ) ) {
390+ this . closeMenu ( ) ;
391+ if ( event . item && event . item . selected ) {
392+ if ( this . itemValueKey ) {
393+ this . propagateChange ( event . item [ this . itemValueKey ] ) ;
399394 } else {
400- this . propagateChange ( null ) ;
395+ this . propagateChange ( event . item ) ;
401396 }
397+ } else {
398+ this . propagateChange ( null ) ;
402399 }
400+ }
403401
404- if ( this . type === "multi" && ! isUpdate ( event ) ) {
405- // if we have a `value` selector and selected items map them appropriately
406- if ( this . itemValueKey && this . view . getSelected ( ) ) {
407- const values = this . view . getSelected ( ) . map ( item => item [ this . itemValueKey ] ) ;
408- this . propagateChange ( values ) ;
409- // otherwise just pass up the values from `getSelected`
410- } else {
411- this . propagateChange ( this . view . getSelected ( ) ) ;
412- }
413- }
414- // only emit selected for "organic" selections
415- if ( ! isUpdate ( event ) ) {
416- this . checkForReorder ( ) ;
417- this . selected . emit ( event ) ;
402+ if ( this . type === "multi" && ! isUpdate ( event ) ) {
403+ // if we have a `value` selector and selected items map them appropriately
404+ if ( this . itemValueKey && this . view . getSelected ( ) ) {
405+ const values = this . view . getSelected ( ) . map ( item => item [ this . itemValueKey ] ) ;
406+ this . propagateChange ( values ) ;
407+ // otherwise just pass up the values from `getSelected`
408+ } else {
409+ this . propagateChange ( this . view . getSelected ( ) ) ;
418410 }
419- } ) ;
411+ }
412+ // only emit selected for "organic" selections
413+ if ( ! isUpdate ( event ) ) {
414+ this . checkForReorder ( ) ;
415+ this . selected . emit ( event ) ;
416+ }
420417 } ) ;
421418 }
422419
0 commit comments