Created
February 20, 2018 11:49
-
-
Save KamaKAzii/94f79fb69555e7250fcf063106b4b054 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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