import { Injectable } from '@angular/core' ; import { BehaviorSubject } from 'rxjs' ; @ Injectable ( { providedIn : 'root' } ) export class HelpCenterService { items : BehaviorSubject < HelpCenterItem [ ] > = new BehaviorSubject < HelpCenterItem [ ] > ( [ ] ) ; registerItem ( item ) { const items = this . items . getValue ( ) ; items . push ( item ) ; this . items . next ( items ) ; } unregisterItem ( item ) { let items = this . items . getValue ( ) ; items = items . filter ( itm => itm !== item ) ; this . items . next ( items ) ; } } export interface HelpCenterItem { icon ? : string ; title : string ; select ? : ( ) => void ; }