provideStore({SearchCounterReducer}, {counter: 0})
Results in:
angular2-polyfills.js:349 Error: Error: Invalid provider - only instances of Provider and Type are allowed, got: [object Object](…)
And the Plunkr does this instead:
provide(Store, {useValue: enhanced(combineReducers({todos, visibilityFilter})) })
Now, enhanced is a variable that is an instrumented version of createStore(). However createStore isn't exported from @ngrx/store. So, it's unclear what my provide SHOULD look like...
Using the Plunkr for main.ts and doing this.store.dispatch() in my class throws dispatch is not a function. Which appears to be because I should be calling createStore(combineReducers(...)) in my provide.
All of the EventEmitter stuff in the Plunker is quite the departure from the ReadMe.md. The ReadMe shows the Redux API way of doing things (i.e. dispatch).
So, what am I missing?
@angular/core was really throwing me off. npm installed a soft dependency on angular2 rc 0. I can't move my whole project right now, so I had to map it to my version of ng2. Then it would compile with (after a little digging):
provideStore(combineReducers(SearchCounterReducer), {counter:0})
npm@2.14.7 node 4.2.1 Chrome latest angular2 beta 17
provideStore({SearchCounterReducer}, {counter: 0})
Results in:angular2-polyfills.js:349 Error: Error: Invalid provider - only instances of Provider and Type are allowed, got: [object Object](…)
And the Plunkr does this instead:
provide(Store, {useValue: enhanced(combineReducers({todos, visibilityFilter})) })
Now,enhanced
is a variable that is an instrumented version ofcreateStore()
. HowevercreateStore
isn't exported from@ngrx/store
. So, it's unclear what myprovide
SHOULD look like...Using the Plunkr for main.ts and doing
this.store.dispatch()
in my class throwsdispatch is not a function
. Which appears to be because I should be callingcreateStore(combineReducers(...))
in myprovide
.All of the EventEmitter stuff in the Plunker is quite the departure from the ReadMe.md. The ReadMe shows the Redux API way of doing things (i.e. dispatch).
So, what am I missing?
@angular/core
was really throwing me off. npm installed a soft dependency on angular2 rc 0. I can't move my whole project right now, so I had to map it to my version of ng2. Then it would compile with (after a little digging):provideStore(combineReducers(SearchCounterReducer), {counter:0})