import { Injectable } from '@angular/core' ; import { Subject } from 'rxjs' ; import { Item , Section } from './ngx-time-scheduler.model' ; @ Injectable ( { providedIn : 'root' } ) export class NgxTimeSchedulerService { public item = new Subject < Item > ( ) ; public itemAdd = new Subject < Item > ( ) ; public itemId = new Subject < number > ( ) ; public sectionAdd = new Subject < Section > ( ) ; public section = new Subject < Section > ( ) ; public sectionId = new Subject < number > ( ) ; public refreshView = new Subject ( ) ; constructor ( ) { } public itemPush ( item ) { this . itemAdd . next ( item ) ; } public itemPop ( ) { this . item . next ( ) ; } public itemRemove ( id ) { this . itemId . next ( id ) ; } public sectionPush ( section ) { this . sectionAdd . next ( section ) ; } public sectionPop ( ) { this . section . next ( ) ; } public sectionRemove ( id ) { this . sectionId . next ( id ) ; } public refresh ( ) { this . refreshView . next ( ) ; } }