metadata service

This commit is contained in:
William Welling
2017-10-12 19:08:03 -05:00
parent c9338e2626
commit f4c0df176e
25 changed files with 1018 additions and 170 deletions

View File

@@ -0,0 +1,34 @@
import { Params } from '@angular/router';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
export class MockActivatedRoute {
private _testParams?: any;
// ActivatedRoute.params is Observable
private subject?: BehaviorSubject<any> = new BehaviorSubject(this.testParams);
params = this.subject.asObservable();
queryParams = this.subject.asObservable();
constructor(params?: Params) {
if (params) {
this.testParams = params;
} else {
this.testParams = {};
}
}
// Test parameters
get testParams() { return this._testParams; }
set testParams(params: {}) {
this._testParams = params;
this.subject.next(params);
}
// ActivatedRoute.snapshot.params
get snapshot() {
return { params: this.testParams };
}
}