projects/wms-framework/src/lib/models/services/tabItem/tabItem.service.ts
Properties |
|
Methods |
Accessors |
emitClearLoadFlag |
emitClearLoadFlag()
|
Clears the loaded flag for every component inside the selected tabitem
Returns :
void
|
emitTabItemVisibilityChanged | ||||||
emitTabItemVisibilityChanged(data: any)
|
||||||
Sends vibility changed message
Parameters :
Returns :
any
any |
emitTabSelectionChanged | ||||||
emitTabSelectionChanged(data: any)
|
||||||
Emit the selection action to trigger the load event every time the component is selected
Parameters :
Returns :
void
|
Private clearLoadFlagEmitted |
Type : Subject<any>
|
Default value : new Subject<any>()
|
Private selectedTab |
Type : number
|
Private tabItemVisibilityEmitted |
Type : Subject<any>
|
Default value : new Subject<any>()
|
Private tabSelectedEmitted |
Type : Subject<any>
|
Default value : new Subject<any>()
|
tabSelectedEvent |
gettabSelectedEvent()
|
Subscribe to this to trigger the load event when the tab is selected.
Returns :
Observable<any>
|
selectedTabIndex |
getselectedTabIndex()
|
Returns the current selected Tab index in case it is changed quickly and not all the loaded events were triggered
Returns :
number
|
events |
getevents()
|
Gets current subscribers list
Returns :
Observable<any>
|
loadTabCleared |
getloadTabCleared()
|
Gets subscriber to clear loaded flag this allows load event to be triggered when the tab is selected
Returns :
Observable<any>
|
import { Subject, Observable } from 'rxjs';
import { Injectable } from '@angular/core';
@Injectable()
export class TabItemService {
private tabItemVisibilityEmitted: Subject<any> = new Subject<any>();
private tabSelectedEmitted: Subject<any> = new Subject<any>();
private clearLoadFlagEmitted: Subject<any> = new Subject<any>();
private selectedTab: number;
/**
* Clears the loaded flag for every component inside
* the selected tabitem
*
* @memberof TabItemService
*/
emitClearLoadFlag(): void {
this.clearLoadFlagEmitted.next(true);
}
/**
* Emit the selection action to trigger the
* load event every time the component is selected
*
* @param {*} data
* @memberof TabItemService
*/
emitTabSelectionChanged(data: any): void {
this.selectedTab = data;
this.tabSelectedEmitted.next(data);
}
/**
* Subscribe to this to trigger the load event when
* the tab is selected.
*
* @readonly
* @type {Observable<any>}
* @memberof TabItemService
*/
get tabSelectedEvent(): Observable<any> {
return this.tabSelectedEmitted.asObservable();
}
/**
* Returns the current selected Tab index
* in case it is changed quickly and not all the loaded
* events were triggered
*
* @readonly
* @type {number}
* @memberof TabItemService
*/
get selectedTabIndex(): number {
return this.selectedTab;
}
/**
* Sends vibility changed message
*
* @param {any} data
* @returns any
*/
emitTabItemVisibilityChanged(data: any): any {
this.tabItemVisibilityEmitted.next(data);
}
/**
* Gets current subscribers list
*
* @returns Observable
*/
get events(): Observable<any> {
return this.tabItemVisibilityEmitted.asObservable();
}
/**
* Gets subscriber to clear loaded flag
* this allows load event to be triggered
* when the tab is selected
*
* @readonly
* @type {Observable<any>}
* @memberof TabItemService
*/
get loadTabCleared(): Observable<any> {
return this.clearLoadFlagEmitted.asObservable();
}
}