Skip to content

Instantly share code, notes, and snippets.

@finki001
Created November 4, 2019 10:13
Show Gist options
  • Save finki001/e61ac85f79a8d1da66873a40eea5cbff to your computer and use it in GitHub Desktop.
Save finki001/e61ac85f79a8d1da66873a40eea5cbff to your computer and use it in GitHub Desktop.
export class TrashComponent implements OnInit, OnDestroy {
const subscription: Subscription;
constructor(private service: TrashService) { }
ngOnInit() {
this.store.dispatch(new UsersActions.Load());
this.subscription = this.service.subscribe(greetings => console.log(greetings));
}
ngOnDestroy() {
this.subscription.unsubscribe();
}
}
@Injectable({
providedIn: "root"
})
export class TrashService {
userDetails:Observable<NoIdeaWhatTypeThisIsBecauseYourQuestionWasNotFormedWell>;
constructor(private store: Store<fromUsersReducer.State>) {
store.dispatch(new UsersActions.Load());
this.userDetails = store.pipe(select(fromUsersReducer.getUsersDetails))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment