All files / src/app/services pager.service.ts

100% Statements 8/8
100% Branches 0/0
100% Functions 3/3
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 281x 1x             1x   39x             3513x             27x      
import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs';
import { PagerModel } from '../models';
 
/**
 * Pager Service
 */
@Injectable()
export class PagerService {
    /** collection of PagerModel */
    private readonly subject = new Subject<PagerModel>();
 
    /**
     * init pager component
     * @param pagerModel: PagerModel
     */
    initPager(pagerModel: PagerModel): void {
        this.subject.next(pagerModel);
    }
 
    /**
     * get current PagerModel
     */
    getPagerModel(): Observable<PagerModel> {
        return this.subject.asObservable();
    }
}