src/lib/src/activated-view.ts
Properties |
|
Methods |
Accessors |
constructor(navigation: Navigable, _data: BehaviorSubject
|
||||||||||||
Defined in src/lib/src/activated-view.ts:9
|
||||||||||||
Parameters :
|
reload |
reload()
|
Defined in src/lib/src/activated-view.ts:26
|
Forces reload of the data (remaining on the current URL). This is identical to calling {@code activatedView.navigation.go(activatedView.snapshot.url)}.
Returns :
void
|
Readonly Public body |
body:
|
Type : Observable<T>
|
Defined in src/lib/src/activated-view.ts:9
|
Readonly Public data |
data:
|
Type : Observable<ViewData<T>>
|
Defined in src/lib/src/activated-view.ts:8
|
Readonly Public navigation |
navigation:
|
Type : Navigable
|
Defined in src/lib/src/activated-view.ts:11
|
snapshot |
getsnapshot()
|
Defined in src/lib/src/activated-view.ts:17
|
import { Observable, BehaviorSubject } from 'rxjs';
import { map } from 'rxjs/operators';
import { Navigable } from './navigable';
import { ViewData } from './view-data';
export class ActivatedView<T> {
public readonly data: Observable<ViewData<T>>;
public readonly body: Observable<T>;
constructor(public readonly navigation: Navigable,
private readonly _data: BehaviorSubject<ViewData<T>>) {
this.data = _data.asObservable();
this.body = this.data.pipe(map(data => data.body));
}
get snapshot() {
return this._data.getValue();
}
/**
* Forces reload of the data (remaining on the current URL).
*
* This is identical to calling {@code activatedView.navigation.go(activatedView.snapshot.url)}.
*/
reload(): void {
this.navigation.go(this.snapshot.url);
}
}