本文整理匯總了TypeScript中ng2-redux/lib.NgRedux類的典型用法代碼示例。如果您正苦於以下問題:TypeScript NgRedux類的具體用法?TypeScript NgRedux怎麽用?TypeScript NgRedux使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了NgRedux類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(private ngRedux:NgRedux<RootState>, private logger:Logger,
private socketService:SocketService) {
// Logger level
logger.level = logger.Level.LOG;
// SocketIO
socketService.subscribe();
const windowWrapper:any = window;
// Redux Store
let enhancers = [windowWrapper.devToolsExtension ? windowWrapper.devToolsExtension() : f => f];
this.ngRedux.configureStore(reducer, {} as RootState, [reduxLogger()], enhancers);
}
示例2: create
create(model: ITripCreateModel) {
this._ngRedux.dispatch({ type: TRIP_CREATE_DOING });
this._tripsService.create(model)
.subscribe(res => {
this._ngRedux.dispatch({ type: TRIP_CREATE_DONE, payload: res });
}, err => {
this._ngRedux.dispatch({ type: TRIP_CREATE_ERROR, payload: err });
})
}
示例3:
}, err => {
this._ngRedux.dispatch({ type: TRIP_CREATE_ERROR, payload: err });
})