Skip to content

Commit

Permalink
Make NgReduxModule.forRoot() expose providers correctly for AoT. (#252)
Browse files Browse the repository at this point in the history
Fixes #215, #228
  • Loading branch information
SethDavenport authored Nov 8, 2016
1 parent 91c5eec commit bdd5bfb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 4.1.0

### Fixes:

* #228 ('generic' error with AoT)
* #251 (No provider for DevToolsExtension)

# 4.0.0

### Features
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng2-redux",
"version": "4.0.0",
"version": "4.1.0",
"description": "Angular 2 bindings for Redux",
"main": "./lib/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/components/dev-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export class DevToolsExtension {
} else if (type === 'STOP') {
subscription();
}

});

return environment.devToolsExtension(options);
}

Expand Down
19 changes: 15 additions & 4 deletions src/ng-redux.module.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
import { NgModule, ModuleWithProviders } from '@angular/core';
import { NgRedux } from './components/ng-redux';
@NgModule({
})
import { DevToolsExtension } from './components/dev-tools';

@NgModule({})
export class NgReduxModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: NgReduxModule,
providers: [NgRedux]
providers: provideRedux(),
};
}
};

export function _ngReduxFactory() {
return new NgRedux(null);
}

export function provideRedux(): any[] {
return [
{ provide: NgRedux, useFactory: _ngReduxFactory },
DevToolsExtension,
];
}

0 comments on commit bdd5bfb

Please sign in to comment.