ng-mat-daterange-picker
Version:
[](https://circleci.com/gh/ashishgkwd/ngx-mat-daterange-picker) [](https
39 lines (30 loc) • 963 B
text/typescript
import { Injectable, Inject, InjectionToken } from '@angular/core';
import { Range } from '../model/model';
import { Subject } from 'rxjs';
/* import { DATE } from '../ngx-drp.module'; */
export const DATE = new InjectionToken<Date>('date');
()
export class RangeStoreService {
rangeUpdate$: Subject<Range> = new Subject<Range>();
constructor(
(DATE) private _fromDate: Date,
(DATE) private _toDate: Date
) {}
/* set fromDate(fromDate:Date) {
this._fromDate = fromDate;
} */
get fromDate(): Date {
return this._fromDate;
}
/* set toDate(toDate:Date) {
this._toDate = toDate;
} */
get toDate(): Date {
return this._toDate;
}
updateRange(fromDate: Date = this._fromDate, toDate: Date = this._toDate) {
this._fromDate = fromDate;
this._toDate = toDate;
this.rangeUpdate$.next({ fromDate: this._fromDate, toDate: this._toDate });
}
}