angularjs-state-emitter
Use an event-based api similar to choo's to manage shared state in your Angular.js 1.x app.
Usage
angularjs-state-emitter
as a dependency of your app:
1. Register var stateEmitter = angular
2. Declare your store in a run block:
angular { stateclicks = 0 emitter}
3. Pass state down from your root component:
{ var ctrl = this ctrlstate = state}
it also works with @ui-router/angularjs
:
$stateProvider;
4. Emit actions from any components
moduleexports = template: `<button ng-click="$ctrl.handleClick()">increment</button>` bindings: state: '<' { var ctrl = this ctrl { } }
Installation
npm install angularjs-state-emitter
Logging
Enable logging through the $stateEmitterProvider
in a config block:
{ $stateEmitterProvider}