Skip to content

Commit

Permalink
Updating the library to newest ng2-redux and newest angular 2. Now us…
Browse files Browse the repository at this point in the history
…ing modules to initialize the bindings, which according to semver requires a major release
  • Loading branch information
dagstuan committed Nov 9, 2016
1 parent 1812e3e commit 001bb3e
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 98 deletions.
46 changes: 11 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# ng2-redux-router 1.3.3
# ng2-redux-router 2.0.0
### Bindings to connect @angular/router to ng2-redux

Updated for Angular 2 final release.

This package uses the new v3 router for angular 2 `@angular/router@^3.0.0`.
This package uses the new v3 router for angular 2 `@angular/router@^3.1.2`.

### Setup

Expand All @@ -26,54 +26,30 @@ This package uses the new v3 router for angular 2 `@angular/router@^3.0.0`.
3. Add the bindings to your root module.
```ts
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { NgRedux } from 'ng2-redux';
import { NgReduxRouter } from 'ng2-redux-router';
import { NgReduxModule, NgRedux } from 'ng2-redux';
import { NgReduxRouterModule, NgReduxRouter } from 'ng2-redux-router';
import { RouterModule } from '@angular/router';
import { routes } from './routes';

@NgModule({
imports: [
RouterModule.forRoot(routes),
NgReduxModule.forRoot(),
NgReduxRouterModule
// ...your imports
],
declarations: [
AppComponent,
// ...your declarations
],
providers: [
NgRedux,
NgReduxRouter,
// ...your providers
],
bootstrap: [
AppComponent
]
// Other stuff..
})
export class AppModule {}
```

4. Initialize the bindings from your app component
```ts
import { NgRedux } from 'ng2-redux';
import { NgReduxRouter } from 'ng2-redux-router';

@Component({
// ...
})
@Routes([
// ...
])
export class App {
export class AppModule {
constructor(
private ngRedux: NgRedux<IAppState>,
private ngReduxRouter: NgReduxRouter
ngRedux: NgRedux<IAppState>,
ngReduxRouter: NgReduxRouter
) {
ngRedux.configureStore(/* args */);
ngReduxRouter.initialize(/* args */);
}
}
```
```

### What if I use Immutable.js with my Redux store?

Expand Down
20 changes: 0 additions & 20 deletions examples/counter/containers/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import { Component } from '@angular/core';
import { AsyncPipe } from '@angular/common';
import { NgRedux, select } from 'ng2-redux';

import { RootState, enhancers } from '../store';

import { NgReduxRouter } from 'ng2-redux-router';

import reducer from '../reducers/index';
const createLogger = require('redux-logger');

@Component({
selector: 'root',
Expand All @@ -22,18 +14,6 @@ const createLogger = require('redux-logger');
`
})
export class AppComponent {
constructor(
private ngRedux: NgRedux<RootState>,
private ngReduxRouter: NgReduxRouter
) {
this.ngRedux.configureStore(
reducer,
{ counter: 0 },
[ createLogger() ],
enhancers
);
ngReduxRouter.initialize();
}
}

@Component({
Expand Down
25 changes: 21 additions & 4 deletions examples/counter/containers/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { routing, AuthGuard } from '../routes';
import { NgReduxModule } from 'ng2-redux';
import { NgReduxRouter } from 'ng2-redux-router';
import { NgReduxModule, NgRedux } from 'ng2-redux';
import { NgReduxRouterModule, NgReduxRouter } from 'ng2-redux-router';
import { Counter } from '../components/Counter';
import { CounterInfo } from '../components/CounterInfo';

import { AppComponent, FirstComponent, SecondComponent, ThirdComponent } from './app.component';

import { RootState, enhancers } from '../store';

import reducer from '../reducers/index';
const createLogger = require('redux-logger');

@NgModule({
imports: [
BrowserModule,
routing,
NgReduxModule
NgReduxModule.forRoot(),
NgReduxRouterModule
],
declarations: [
AppComponent,
Expand All @@ -23,12 +29,23 @@ import { AppComponent, FirstComponent, SecondComponent, ThirdComponent } from '.
CounterInfo
],
providers: [
NgReduxRouter,
AuthGuard
],
bootstrap: [
AppComponent
]
})
export class AppModule {
constructor(
ngRedux: NgRedux<RootState>,
ngReduxRouter: NgReduxRouter
) {
ngRedux.configureStore(
reducer,
{ counter: 0 },
[ createLogger() ],
enhancers
);
ngReduxRouter.initialize();
}
}
36 changes: 18 additions & 18 deletions examples/counter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,30 @@
},
"homepage": "https://github.com/wbuchwalter/ng2-redux#readme",
"dependencies": {
"@angular/common": "^2.0.0",
"@angular/compiler": "^2.0.0",
"@angular/core": "^2.0.0",
"@angular/http": "^2.0.0",
"@angular/platform-browser": "^2.0.0",
"@angular/platform-browser-dynamic": "^2.0.0",
"@angular/compiler-cli": "^0.6.2",
"@angular/platform-server": "^2.0.0",
"@angular/router": "^3.0.0",
"@angular/common": "^2.1.2",
"@angular/compiler": "^2.1.2",
"@angular/core": "^2.1.2",
"@angular/http": "^2.1.2",
"@angular/platform-browser": "^2.1.2",
"@angular/platform-browser-dynamic": "^2.1.2",
"@angular/compiler-cli": "^2.1.2",
"@angular/platform-server": "^2.1.2",
"@angular/router": "^3.1.2",
"core-js": "^2.4.0",
"ng2-redux": "^4.0.0-beta.1",
"ng2-redux-router": "^1.3.3",
"ng2-redux": "^4.1.0",
"ng2-redux-router": "^2.0.0",
"redux": "^3.6.0",
"redux-localstorage": "^0.4.0",
"redux-logger": "^2.6.1",
"redux-logger": "^2.7.4",
"rxjs": "5.0.0-beta.12",
"zone.js": "^0.6.23"
"zone.js": "^0.6.26"
},
"devDependencies": {
"@types/core-js": "^0.9.32",
"@types/node": "^6.0.38",
"@types/core-js": "^0.9.34",
"@types/node": "^6.0.46",
"awesome-typescript-loader": "^2.2.4",
"typescript": "^2.0.2",
"webpack": "^1.9.11",
"webpack-dev-server": "^1.15.2"
"typescript": "^2.0.8",
"webpack": "^1.13.3",
"webpack-dev-server": "^1.16.2"
}
}
37 changes: 19 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,33 @@
"url": "git+https://github.com/dagstuan/ng2-redux-router.git"
},
"scripts": {
"build": "rimraf ./lib && npm run build:es6 && npm run build:es5 && npm run build:esm",
"build:es6": "ngc --p tsconfig.es6.json --diagnostics --pretty",
"build:esm": "ngc --p tsconfig.esm.json --diagnostics --pretty",
"build:es5": "ngc --p tsconfig.json --diagnostics --pretty"
"build": "rimraf ./lib && npm run build:es5 && npm run build:esm && npm run build:es6",
"postbuild": "rimraf \"src/**/*.ngfactory.ts\"",
"build:es6": "ngc -p tsconfig.es6.json && npm run postbuild",
"build:esm": "ngc -p tsconfig.esm.json && npm run postbuild",
"build:es5": "ngc -p tsconfig.json && npm run postbuild"
},
"peerDependencies": {
"@angular/core": "^2.0.0",
"@angular/core": "^2.1.2",
"@angular/router": "^3.0.0"
},
"devDependencies": {
"@angular/common": "^2.0.0",
"@angular/compiler": "^2.0.0",
"@angular/compiler-cli": "^0.6.2",
"@angular/core": "^2.0.0",
"@angular/platform-browser": "^2.0.0",
"@angular/platform-browser-dynamic": "^2.0.0",
"@angular/platform-server": "^2.0.0",
"@angular/router": "^3.0.0",
"@types/core-js": "^0.9.32",
"@types/jasmine": "^2.2.33",
"ng2-redux": "^4.0.0-beta.1",
"@angular/common": "^2.1.2",
"@angular/compiler": "^2.1.2",
"@angular/compiler-cli": "^2.1.2",
"@angular/core": "^2.1.2",
"@angular/platform-browser": "^2.1.2",
"@angular/platform-browser-dynamic": "^2.1.2",
"@angular/platform-server": "^2.1.2",
"@angular/router": "^3.1.2",
"@types/core-js": "^0.9.34",
"@types/jasmine": "^2.5.37",
"ng2-redux": "^4.1.0",
"redux": "^3.6.0",
"rimraf": "^2.5.4",
"rxjs": "5.0.0-beta.12",
"typescript": "^2.0.2",
"zone.js": "^0.6.23"
"typescript": "^2.0.8",
"zone.js": "^0.6.26"
},
"author": "Dag Stuan",
"license": "MIT"
Expand Down
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import { UPDATE_LOCATION } from './actions';
@NgModule({
providers: [ NgReduxRouter ]
})
class NgReduxRouterModule { }
export class NgReduxRouterModule { }

export {
NgReduxRouterModule,
NgReduxRouter,
RouterAction,
routerReducer,
Expand Down
1 change: 1 addition & 0 deletions tsconfig.es6.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"types": []
},
"exclude": [
"lib",
"node_modules",
"spec",
"release",
Expand Down
5 changes: 4 additions & 1 deletion tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
"experimentalDecorators": true,
"removeComments": false,
"declaration": true,
"types": ["core-js"]
"types": [
"core-js"
]
},
"exclude": [
"lib",
"node_modules",
"spec",
"release",
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
]
},
"exclude": [
"lib",
"node_modules",
"spec",
"release",
Expand Down

0 comments on commit 001bb3e

Please sign in to comment.