Setup a store
import NgStore from 'angularjs-store';
const initialState = { count: 0 };
const counterStore = new NgStore(initialState);import NgStore from 'angularjs-store';
type CounterState = { count: 0 };
type CounterActions = ['INCREMENT_COUNT', 'DECREMENT_COUNT'];
const counterStore = new NgStore<CounterState, CounterActions>({ count: 0 });import NgStore from 'angularjs-store';
export type CounterState = { count: number };
export type CounterActions = ['INCREMENT_COUNT', 'DECREMENT_COUNT'];
export type CounterStore = NgStore<CounterState, CounterActions>;
function counterStore() {
const initialState: CounterState = { count: 0 };
const counterStore: CounterStore = new NgStore(initialState);
return counterStore;
}
angular
.module('app', [])
.service('counterStore', counterStore);Last updated
Was this helpful?