Skip to content

Instantly share code, notes, and snippets.

@splincode
Created May 9, 2020 16:03
Show Gist options
  • Save splincode/2dd18e23ead970d382a2690c380589cc to your computer and use it in GitHub Desktop.
Save splincode/2dd18e23ead970d382a2690c380589cc to your computer and use it in GitHub Desktop.
// ...
@Component({
selector: 'counter',
template: `
value: {{ (counter$ | async).value }} <br>
<button (click)="increment()">increment</button>
`
})
export class CounterComponent {
@Select(CounterState)
public counter$: Observable<CounterModel>;
constructor(private store: Store) {}
public increment(): void {
this.store.dispatch(new IncrementAction());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment