STORE
Creating actions
export class AddAnimal {
static readonly type = '[Zoo] Add Animal';
constructor(public name: string) {}
}Dispatching actions
import { Store } from '@ngxs/store';
import { AddAnimal } from './animal.actions';
@Component({ ... })
export class ZooComponent {
constructor(private store: Store) {}
addAnimal(name: string) {
this.store.dispatch(new AddAnimal(name));
}
}dispatch Utility
dispatch UtilitySnapshots
Selecting State
Reset
Last updated

