Created
May 9, 2020 16:03
-
-
Save splincode/2dd18e23ead970d382a2690c380589cc 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
// ... | |
@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