Skip to content

Instantly share code, notes, and snippets.

@splincode
Last active February 15, 2019 21:35
Show Gist options
  • Save splincode/235e668275de55342ae188744aa2d138 to your computer and use it in GitHub Desktop.
Save splincode/235e668275de55342ae188744aa2d138 to your computer and use it in GitHub Desktop.
import { Dispatch } from '@ngxs-labs/dispatch-decorator';
import { CounterState, Increment } from './counter.state';
...
@Component({
selector: 'my-app',
template: `
<h1>Count is {{ counter$ | async }}<h1>
<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