File

src/lib/src/activated-view.ts

Index

Properties
Methods
Accessors

Constructor

constructor(navigation: Navigable, _data: BehaviorSubject>)
Parameters :
Name Type Optional Description
navigation Navigable
_data BehaviorSubject<ViewData<T>>

Methods

reload
reload()

Forces reload of the data (remaining on the current URL).

This is identical to calling {@code activatedView.navigation.go(activatedView.snapshot.url)}.

Returns : void

Properties

Readonly Public body
body: Observable<T>
Type : Observable<T>
Readonly Public data
data: Observable<ViewData<T>>
Type : Observable<ViewData<T>>
Readonly Public navigation
navigation: Navigable
Type : Navigable

Accessors

snapshot
getsnapshot()
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);
  }
}

results matching ""

    No results matching ""