Skip to content

Instantly share code, notes, and snippets.

@splincode
Last active January 2, 2019 14:11
Show Gist options
  • Save splincode/b9c798f05937e55c0528dff1be7fd3c6 to your computer and use it in GitHub Desktop.
Save splincode/b9c798f05937e55c0528dff1be7fd3c6 to your computer and use it in GitHub Desktop.
@Component({
selector: 'app-root',
template: `
<ng-container *ngIf="counter$ | async as counter">
<h1>{{ counter }}</h1>
</ng-container>
<button (click)="increment()">Increment</button>
`
})
export class AppComponent {
@Select(CounterState)
public counter$: Observable<number>;
@Dispatch()
public increment = () => new Increment()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment