Last active
January 3, 2019 13:03
-
-
Save advorkina/9bcabaf50d69fcc1f2496a50f21b9999 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
import { State, Action, StateContext } from '@ngxs/store'; | |
import { Open } from './actions/home.actions'; | |
interface IHomeState { | |
isOpen: boolean; | |
} | |
@State<IHomeState>({ | |
name: 'home', | |
defaults: { | |
isOpen: false | |
} | |
}) | |
export class HomeState { | |
@Action(Open) | |
open(ctx: StateContext<IHomeState>) { | |
const state = ctx.getState(); | |
ctx.setState({ | |
...state, | |
isOpen: true | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment