ng-redux

翻译自ng-redux的文档:
https://github.com/angular-redux/ng-redux


ngRedux 让你能非常容易的将你的angular组件和Redux连接起来。

目录:

  • 安装
  • 快速开始
  • API
  • Dependency Injectable Middleware
  • 路由
  • 使用开发工具
  • additional resources

安装


npm

npm install --save ng-redux

bower

bower install --save ng-redux

将下面的标签加入到你的HTML中:


快速开始


安装
你可以通过函数或者对象来createStoreWith

  1. 通过function:
import reducers from './reducers';
import {combineReducers} from 'redux';
import loggingMiddleware from './loggingMiddleware';
angular.module('app', [ngRedux]).config(($ngReduxProvider) => {
  let reducer = combineReducers(reducers);
  $ngReduxProvider.createStoreWith(reducer, ['promiseMiddleware', loggingMiddleware]);
}
  1. 通过object:
import reducers from './reducers';import { combineReducers } from 'redux';import loggingMiddleware from './loggingMiddleware';import ngRedux from 'ng-redux';import reducer3 from './reducer3';angular.module('app', [ngRedux]).config(($ngReduxProvider) => { reducer3 = function(state, action){} $ngReduxProvider.createStoreWith({ reducer1: "reducer1", reducer2: function(state, action){}, reducer3: reducer3 }, ['promiseMiddleware', loggingMiddleware]); });

你可能感兴趣的:(ng-redux)