Skip to content

Instantly share code, notes, and snippets.

@KamaKAzii
Created February 20, 2018 11:49
Show Gist options
  • Save KamaKAzii/94f79fb69555e7250fcf063106b4b054 to your computer and use it in GitHub Desktop.
Save KamaKAzii/94f79fb69555e7250fcf063106b4b054 to your computer and use it in GitHub Desktop.
import { Component, OnInit, OnDestroy } from "@angular/core";
import { Store } from "@ngrx/store";
import { AppState } from "../store/app-state";
import { Subscription } from "rxjs/Subscription";
import { xxxStore } from "../store/xxx";
import { xxx } from "../models/xxx";
@Component({
selector: 'xxx',
templateUrl: './xxx.pug',
})
export class xxxComponent implements OnInit, OnDestroy {
private xxxSubscription: Subscription
public xxx: xxx[]
constructor(
private store: Store<AppState>,
) {}
ngOnInit() {
this.xxxSubscription =
this.store.select("xxxReducer")
.subscribe((s: xxxStore) => {
this.xxx = s.xxx
})
}
ngOnDestroy() {
this.xxxSubscription.unsubscribe()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment