-import {Component, OnInit, Input, Output, EventEmitter} from '@angular/core';
+import {Component, OnInit, Input, Output, ViewChild, EventEmitter} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {map, debounceTime} from 'rxjs/operators';
+import {Subject} from 'rxjs/Subject';
import {EgAuthService} from '@eg/core/auth.service';
import {EgStoreService} from '@eg/core/store.service';
import {EgOrgService} from '@eg/core/org.service';
import {EgIdlObject} from '@eg/core/idl.service';
-import {NgbTypeaheadSelectItemEvent} from '@ng-bootstrap/ng-bootstrap';
+import {NgbTypeahead, NgbTypeaheadSelectItemEvent}
+ from '@ng-bootstrap/ng-bootstrap';
// Use a unicode char for spacing instead of ASCII=32 so the browser
// won't collapse the nested display entries down to a single space.
startOrg: EgIdlObject;
hidden: number[] = [];
disabled: number[] = [];
+ //focus$ = new Subject<string>();
+ click$ = new Subject<string>();
+
+ @ViewChild('instance') instance: NgbTypeahead;
// Read-only properties optionally provided by the calling component.
@Input() placeholder: string;
return text$
.debounceTime(100)
.distinctUntilChanged()
+ .merge(this.click$.filter(() => !this.instance.isPopupOpen()))
.map(term => {
return this.org.list().filter(org => {