Of course, you can do your thing using only $rootScope . But there are many other goals that will interfere with your state.
We will see:
// reducer-like $rootScope.$on('COUNTER_INCREMENT', (e, action) => { //I don't use += to emphase immutability of count property; $rootScope.count = $rootScope.count + action.value; }); //action-ish creator $rootScope.$broadcast('COUNTER_INCREMENT', {value: 5}); //store subscribe-like $rootScope.$watch('count', (count) => { //update something in your component })
You can do this if you want, but you see there a problem with unclear immutability. It is very difficult to control that your action handler is clean, because in reality it is not.
There is no default action handler; you cannot easily set the initial state of the repository. And you still use $watch and digests, which you probably want to avoid.
In addition, you cannot subscribe to all updates, there is no single reset point of everything, as Redux does with time travel.
If you want to use Redux as a template, you will probably end up with some helpers that will make your code more like Redux.
Well, why not just start using Redux from a simple angular utility:
angular.module('app', []).factory('store', () => { //if you have many reducers, they should be as separate modules, and imported here function counter(state = 0, action) { switch (action.type) { case 'INCREMENT': return state + action.value; default: return state; } } // here you can add here middlewares that make Redux so powerful return Redux.createStore(counter); });
Here we go. Now you can use the service of your store for action.
angular.module('app').controller('MyController', ($scope, store) => { store.subscribe(() => { //you may not to care about $scope.$digest, if your action was triggered within angular scope as well $scope.count = store.getState(); }); $scope.onClick = () => store.dispatch({type: 'INCREMENT', value: 1}); });
Now you have the correct setting, in which your subscribers are not aware of the action that caused the dispatch, your action and the logic of actions are completely independent, as required by the Redux template.