Created
February 15, 2019 21:45
-
-
Save splincode/b9af2d3ffaac59fcf08be4924dc03a74 to your computer and use it in GitHub Desktop.
This file contains 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
import { Dispatch } from '@ngxs-labs/dispatch-decorator'; | |
... | |
@Component({ | |
selector: 'my-app', | |
template: ` | |
{{ stateA$ | async }} | |
{{ stateB$ | async }} | |
{{ stateC$ | async }} | |
... | |
<button (click)="actionA()">actionA</button> | |
<button (click)="actionB()">actionB</button> | |
<button (click)="actionC()">actionC</button> | |
... | |
` | |
}) | |
export class AppComponent { | |
@Select(StateA) public stateA$: Observable<any>; | |
@Select(StateB) public stateB$: Observable<any>; | |
@Select(StateC) public stateC$: Observable<any>; | |
... | |
@Dispatch() public actionA = () => new ActionA(); | |
@Dispatch() public actionB = () => new ActionB(); | |
@Dispatch() public actionC = () => new ActionC(); | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment