Skip to content

Instantly share code, notes, and snippets.

@adamgen
Created May 6, 2020 16:37
Show Gist options
  • Save adamgen/8936c8eb8628ae56c8ba41ffe60f298d to your computer and use it in GitHub Desktop.
Save adamgen/8936c8eb8628ae56c8ba41ffe60f298d to your computer and use it in GitHub Desktop.
NGRX | Use effects and router-store to isolate route related side πŸ§™πŸΌβ€β™‚οΈ effects - good component
import { Store, select } from β€˜@ngrx/store’;
import { Component } from β€˜@angular/core’;
@Component({
selector: β€˜app-root’,
template: `{{selectedId$ | async | json}}`,
})
export class HomeComponent {
selectedId$ = this.store.pipe(select((state: any) => state.featureName.selectedId));
constructor(
private store: Store,
) { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment