mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2676] Demo shell pagination bug fix (#3174)
* Demo shell pagination bug fix * tslint error fix * user preferences service fix * refactor * refactor * refactor * unit tests added * unit tests fix * [ADF-2676] added documentation for app config onChange stream * [ADF-2676] renamed onChange stream to onLoad stream * [ADF-2676] fixed test
This commit is contained in:
committed by
Eugenio Romano
parent
d0f5bad894
commit
66d8935624
@@ -18,6 +18,8 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ObjectUtils } from '../utils/object-utils';
|
||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
@Injectable()
|
||||
export class AppConfigService {
|
||||
@@ -34,7 +36,16 @@ export class AppConfigService {
|
||||
alfrescoRepositoryName: 'alfresco-1'
|
||||
};
|
||||
|
||||
private onLoadSubject: BehaviorSubject<any>;
|
||||
onLoad: Observable<any>;
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
this.onLoadSubject = new BehaviorSubject(this.config);
|
||||
this.onLoad = this.onLoadSubject.asObservable();
|
||||
}
|
||||
|
||||
select(property: string): Observable<any> {
|
||||
return this.onLoadSubject.map((config) => config[property]).distinctUntilChanged();
|
||||
}
|
||||
|
||||
get<T>(key: string, defaultValue?: T): T {
|
||||
@@ -65,6 +76,7 @@ export class AppConfigService {
|
||||
this.http.get('app.config.json').subscribe(
|
||||
(data: any) => {
|
||||
this.config = Object.assign({}, this.config, data || {});
|
||||
this.onLoadSubject.next(this.config);
|
||||
resolve(this.config);
|
||||
},
|
||||
() => {
|
||||
|
Reference in New Issue
Block a user