Listen on state changes
import { CounterState, CounterStore } from 'counter-store';
function YourController($scope: ng.IScope, counterStore: CounterStore) {
counterStore.hook('INCREMENT_COUNT', (state) => {
$scope.count = state.count;
});
counterStore.hook('DECREMENT_COUNT', ({ count }) => {
$scope.count = count;
});
}
angular
.module('App', [])
.controller('YourController', YourController);Last updated
Was this helpful?