diff --git a/src/framework/theme/components/select/select.component.ts b/src/framework/theme/components/select/select.component.ts index c3c00f54a9..2d4e802f37 100644 --- a/src/framework/theme/components/select/select.component.ts +++ b/src/framework/theme/components/select/select.component.ts @@ -699,7 +699,7 @@ export class NbSelectComponent implements AfterViewInit, AfterContentInit, On } ngAfterContentInit() { - if (this.queue) { + if (this.queue != null) { // Call 'writeValue' when current change detection run is finished. // When writing is finished, change detection starts again, since // microtasks queue is empty. diff --git a/src/framework/theme/components/select/select.spec.ts b/src/framework/theme/components/select/select.spec.ts index 85c19d2167..e07703db3f 100644 --- a/src/framework/theme/components/select/select.spec.ts +++ b/src/framework/theme/components/select/select.spec.ts @@ -813,6 +813,19 @@ describe('NbSelectComponent - falsy values', () => { expect(testComponent.truthyOptionElement.nativeElement.querySelector('nb-checkbox')).not.toEqual(null); }); }); + + it('should select initial falsy value', fakeAsync(() => { + fixture = TestBed.createComponent(NbSelectWithFalsyOptionValuesComponent); + testComponent = fixture.componentInstance; + select = fixture.debugElement.query(By.directive(NbSelectComponent)).componentInstance; + + select.selected = ''; + fixture.detectChanges(); + flush(); + + expect(select.selectionModel[0]).toEqual(testComponent.emptyStringOption); + expect(testComponent.emptyStringOption.selected).toEqual(true); + })); }); describe('NbSelectComponent - Triggers', () => {