Skip to content
tja4472 edited this page Jan 20, 2018 · 7 revisions

@aph5nt you are not thinking reactive enough

onClick$ = new Subject();

constructor(private _store: Store) { this.onClick$ .withLatestFrom(this._store) .subscribe(([data, state]) => { // do whatever you want here }); } <button (click)="onClick$.next({ foo: 'bar', baz: $event })">click common use-case for this is when you map these handlers to ngrx actions, merge them and subscribe them to your store, which means that clicking button will essentially dispatch an action to the store, see #173 (comment)>

https://github.com/ngrx/store/issues/296#issuecomment-291780143

Clone this wiki locally