{"action":"created","issue":{"url":"https://api.github.com/repos/wbuchwalter/ng-redux/issues/76","repository_url":"https://api.github.com/repos/wbuchwalter/ng-redux","labels_url":"https://api.github.com/repos/wbuchwalter/ng-redux/issues/76/labels{/name}","comments_url":"https://api.github.com/repos/wbuchwalter/ng-redux/issues/76/comments","events_url":"https://api.github.com/repos/wbuchwalter/ng-redux/issues/76/events","html_url":"https://github.com/wbuchwalter/ng-redux/pull/76","id":148445089,"number":76,"title":"createStoreWith accepts either a function or an object with reducers","user":{"login":"hgsigner","id":599476,"avatar_url":"https://avatars.githubusercontent.com/u/599476?v=3","gravatar_id":"","url":"https://api.github.com/users/hgsigner","html_url":"https://github.com/hgsigner","followers_url":"https://api.github.com/users/hgsigner/followers","following_url":"https://api.github.com/users/hgsigner/following{/other_user}","gists_url":"https://api.github.com/users/hgsigner/gists{/gist_id}","starred_url":"https://api.github.com/users/hgsigner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hgsigner/subscriptions","organizations_url":"https://api.github.com/users/hgsigner/orgs","repos_url":"https://api.github.com/users/hgsigner/repos","events_url":"https://api.github.com/users/hgsigner/events{/privacy}","received_events_url":"https://api.github.com/users/hgsigner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-14T18:27:36Z","updated_at":"2016-04-15T15:05:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/wbuchwalter/ng-redux/pulls/76","html_url":"https://github.com/wbuchwalter/ng-redux/pull/76","diff_url":"https://github.com/wbuchwalter/ng-redux/pull/76.diff","patch_url":"https://github.com/wbuchwalter/ng-redux/pull/76.patch"},"body":"Hi, \r\n\r\nThis PR aims to solve this issue -> https://github.com/wbuchwalter/ng-redux/issues/75 but in a different manner. We've implemented a way to pass the reducer as a single Function or as an Object. This is extremely helpful because we can create the reducers as an angular services and initialize it in the .config.\r\n\r\nThe reducer object would accept a function or a string for its values. Using it as a string, we can later use $injector.get(\"myReducerAsService\") and get it injected.\r\n\r\nIt'll work like this:\r\n\r\n```angular.module(\"myapp\").config([\r\n  \"$ngReduxProvider\", \"Redux\"\r\n  \"ReduxThunk\"\r\n  (\r\n    $ngReduxProvider, Redux, thunk\r\n  ) ->\r\n    $ngReduxProvider.createStoreWith({reducerAsService: \"reducerAsService\", reducerAsFunctions: fnction(){}}, [thunk])\r\n    return\r\n])```\r\n\r\nLet me know what you think.\r\nThanks"},"comment":{"url":"https://api.github.com/repos/wbuchwalter/ng-redux/issues/comments/210497229","html_url":"https://github.com/wbuchwalter/ng-redux/pull/76#issuecomment-210497229","issue_url":"https://api.github.com/repos/wbuchwalter/ng-redux/issues/76","id":210497229,"user":{"login":"jballands","id":2644971,"avatar_url":"https://avatars.githubusercontent.com/u/2644971?v=3","gravatar_id":"","url":"https://api.github.com/users/jballands","html_url":"https://github.com/jballands","followers_url":"https://api.github.com/users/jballands/followers","following_url":"https://api.github.com/users/jballands/following{/other_user}","gists_url":"https://api.github.com/users/jballands/gists{/gist_id}","starred_url":"https://api.github.com/users/jballands/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jballands/subscriptions","organizations_url":"https://api.github.com/users/jballands/orgs","repos_url":"https://api.github.com/users/jballands/repos","events_url":"https://api.github.com/users/jballands/events{/privacy}","received_events_url":"https://api.github.com/users/jballands/received_events","type":"User","site_admin":false},"created_at":"2016-04-15T15:05:15Z","updated_at":"2016-04-15T15:05:15Z","body":"Hi Hugo, thanks for looking into this! I went through your pull request and I'm wondering if this completely solves the problem of providing 1 reducer for `n` modules.\r\n\r\nCorrect me if I'm wrong, but it seems that I must provide an Angular service that has the ability to provide all reducers for my application. In issue #75, I mention that, in order to not violate the single responsibility principle, I would like each module to be responsible for registering it's own reducers with ngRedux; in other words, `$ngReduxProvider` should be able to provide an `$ngRedux` that is composed of multiple reducers from multiple different controllers and services, not just one service that gathers all the reducers for the application up. That should be the `$ngReduxProvider`'s job, in my opinion.\r\n\r\nAgain, perhaps I'm just misunderstanding what you wrote, so thanks again for taking this on :)"}}