@@ -4,27 +4,27 @@ import 'zone.js/dist/zone';
4
4
import 'zone.js/dist/long-stack-trace-zone' ;
5
5
import 'ts-helpers' ;
6
6
7
- import {
8
- provideForms ,
9
- REACTIVE_FORM_DIRECTIVES ,
10
- disableDeprecatedForms ,
11
- FormGroup ,
12
- } from '@angular/forms' ;
13
- import { Component , provide } from '@angular/core' ;
14
- import { bootstrap } from '@angular/platform-browser-dynamic' ;
7
+ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' ;
8
+ import { BrowserModule } from '@angular/platform-browser' ;
9
+ import { Component , NgModule } from '@angular/core' ;
10
+ import { FormsModule , ReactiveFormsModule } from '@angular/forms' ;
11
+
12
+ import { Map , fromJS } from 'immutable' ;
15
13
16
- import { Map , fromJS } from 'immutable ' ;
14
+ import { NgRedux , select } from 'ng2-redux ' ;
17
15
18
- import { NgRedux , select } from 'ng2- redux' ;
16
+ import { combineReducers } from 'redux' ;
19
17
20
- import { combineReducers } from 'redux' ;
18
+ import {
19
+ Connect ,
20
+ ConnectArray ,
21
+ FormStore ,
22
+ NgReduxForms ,
23
+ composeReducers ,
24
+ defaultFormReducer ,
25
+ } from '../../source' ;
21
26
22
- import { Connect } from '../../source/connect' ;
23
- import { ConnectArray } from '../../source/connect-array' ;
24
- import { composeReducers } from '../../source/compose-reducers' ;
25
- import { defaultFormReducer } from '../../source/form-reducer' ;
26
- import { provideFormConnect } from '../../source/configure' ;
27
- import { logger } from '../../source/tests.utilities' ;
27
+ import { logger } from '../../source/tests.utilities' ;
28
28
29
29
@Component ( {
30
30
selector : 'form-example' ,
@@ -74,11 +74,6 @@ import { logger } from '../../source/tests.utilities';
74
74
</div>
75
75
</div>
76
76
` ,
77
- directives : [
78
- Connect ,
79
- ConnectArray ,
80
- REACTIVE_FORM_DIRECTIVES ,
81
- ] ,
82
77
styles : [ require ( './index.css' ) ]
83
78
} )
84
79
export class FormExample {
@@ -96,10 +91,6 @@ export class FormExample {
96
91
type : 'ADD_FORM_ENTRY'
97
92
} ) ;
98
93
}
99
-
100
- stringify ( obj ) {
101
- return JSON . stringify ( obj ) ;
102
- }
103
94
}
104
95
105
96
@Component ( {
@@ -117,7 +108,6 @@ export class FormExample {
117
108
</li>
118
109
</ul>
119
110
` ,
120
- directives : [ Connect , REACTIVE_FORM_DIRECTIVES ]
121
111
} )
122
112
export class TodoExample {
123
113
@select ( s => s . todos . get ( 'list' ) ) private list ;
@@ -142,9 +132,12 @@ export class TodoExample {
142
132
<form-example></form-example>
143
133
<todo-example></todo-example>
144
134
` ,
145
- directives : [ FormExample , TodoExample ]
146
135
} )
147
- export class Example { }
136
+ export class Example {
137
+ constructor ( private ngRedux : NgRedux < AppState > ) {
138
+ ngRedux . configureStore ( reducer , { form1, todos} , [ logger ] , [ ] ) ;
139
+ }
140
+ }
148
141
149
142
interface AppState {
150
143
form1 ?: {
@@ -215,13 +208,23 @@ function todoReducer(state = todos, action: {type: string, payload?}) {
215
208
return state ;
216
209
}
217
210
218
- const ngRedux = new NgRedux < AppState > ( ) ;
219
-
220
- ngRedux . configureStore ( reducer , { form1, todos} , [ logger ] , [ ] ) ;
211
+ @NgModule ( {
212
+ imports : [
213
+ BrowserModule ,
214
+ ReactiveFormsModule ,
215
+ FormsModule ,
216
+ NgReduxForms ,
217
+ ] ,
218
+ declarations : [
219
+ FormExample ,
220
+ TodoExample ,
221
+ Example ,
222
+ ] ,
223
+ providers : [
224
+ NgRedux ,
225
+ ] ,
226
+ bootstrap : [ Example ]
227
+ } )
228
+ export class ExampleModule { }
221
229
222
- bootstrap ( Example , [
223
- provide ( NgRedux , { useValue : ngRedux } ) ,
224
- disableDeprecatedForms ( ) ,
225
- provideForms ( ) ,
226
- provideFormConnect ( ngRedux ) ,
227
- ] ) ;
230
+ platformBrowserDynamic ( ) . bootstrapModule ( ExampleModule ) ;
0 commit comments