25 lines
668 B
TypeScript
25 lines
668 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { Observable, Subject } from 'rxjs';
|
|
import { DropDownOption } from '../../entity/dropDownOption';
|
|
import { DropDownBag } from './drop-down-menu/drop-down-menu.component';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class DropDownListService {
|
|
|
|
constructor() { }
|
|
onItemSelect = new Subject<DropDownBag>();
|
|
|
|
focusIndexChange = new Subject<DropDownBag>();
|
|
|
|
|
|
selectItem(tag: string, item: DropDownOption) {
|
|
this.onItemSelect.next({ tag: tag, item: item } as DropDownBag)
|
|
}
|
|
setFocusIndex(tag: string, i: number) {
|
|
this.focusIndexChange.next(
|
|
{ tag: tag, focusIndex: i } as DropDownBag);
|
|
}
|
|
}
|