From ad82bd8d110b666f719645608f1773061cdf985f Mon Sep 17 00:00:00 2001 From: Roman Sliusarchuk Date: Tue, 4 Sep 2018 09:11:24 +0300 Subject: [PATCH] Fix on change data --- lib/ng2-select2.component.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ng2-select2.component.ts b/lib/ng2-select2.component.ts index 959a334..bb0b2a7 100644 --- a/lib/ng2-select2.component.ts +++ b/lib/ng2-select2.component.ts @@ -139,14 +139,14 @@ export class Select2Component implements AfterViewInit, OnChanges, OnDestroy, On let oldMatcher: any = await this.requireOldMatcher(); options.matcher = oldMatcher(options.matcher); this.element.select2(options); - - if (typeof this.value !== 'undefined') { - this.setElementValue(this.value); - } } else { this.element.select2(options); } + if (typeof this.value !== 'undefined') { + this.setElementValue(this.value); + } + if(this.disabled) { this.renderer.setElementProperty(this.selector.nativeElement, 'disabled', this.disabled); }