mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor(autocomplete): merge optionSelections into single observable (#3212)
Merges the `optionSelections` into a single observable, in order to make it easier to consume. Fixes #3205.
This commit is contained in:
committed by
mmalerba
parent
ceb472bab6
commit
e3b2486c4b
@@ -153,15 +153,15 @@ export class MdAutocompleteTrigger implements AfterContentInit, ControlValueAcce
|
||||
*/
|
||||
get panelClosingActions(): Observable<MdOptionSelectEvent> {
|
||||
return Observable.merge(
|
||||
...this.optionSelections,
|
||||
this.optionSelections,
|
||||
this._blurStream.asObservable(),
|
||||
this._keyManager.tabOut
|
||||
);
|
||||
}
|
||||
|
||||
/** Stream of autocomplete option selections. */
|
||||
get optionSelections(): Observable<MdOptionSelectEvent>[] {
|
||||
return this.autocomplete.options.map(option => option.onSelect);
|
||||
get optionSelections(): Observable<MdOptionSelectEvent> {
|
||||
return Observable.merge(...this.autocomplete.options.map(option => option.onSelect));
|
||||
}
|
||||
|
||||
/** The currently active option, coerced to MdOption type. */
|
||||
|
||||
Reference in New Issue
Block a user