Reputation: 1104
I'm working on a Angular 2 project using this seed: angular2-webpack-starter and I'm also using @ngrx/store & @ngrx/store-devtools.
During bootstraping, the application throws an error :
zone.js:260 - Uncaught Invalid provider - only instances of Provider and Type are allowed, got: [object Object]
Here is how I setting up @ngrx with the seed :
vendor.browser.ts
// ngrx
import '@ngrx/core';
import '@ngrx/store';
import 'ngrx-store-router';
if ('production' === ENV) {
// Production
} else {
// Development
require('angular2-hmr');
require('@ngrx/store-devtools');
require('@ngrx/store-log-monitor');
}
browser-providers.ts
)// @ngrx/store
import { provideStore } from '@ngrx/store';
// @ngrx/devtools
import { instrumentStore } from '@ngrx/store-devtools';
import { useLogMonitor } from '@ngrx/store-log-monitor';
// link angular's router with ngrx/sotre
import { routerMiddleware } from 'ngrx-store-router';
// custom data for ngrx
import { REDUCERS, initialState } from '../app/shared/redux';
export const APPLICATION_PROVIDERS = [
// awesome redux implementation for angular
provideStore(REDUCERS, initialState),
instrumentStore({
monitor: useLogMonitor({
visible: true,
position: 'right'
})
}),
// link angular's router with ngrx/sotre
routerMiddleware,
//...
];
<ngrx-store-log-monitor toggleCommand="ctrl-h" positionCommand="ctrl-m"></ngrx-store-log-monitor>
.
Simple.
But when I console.log
what instrumentStore()
returns, I get an array of objects. But Angular needs and array of Providers.
Here are the versions of my packages:
If it's an issue, I'll report in on the Github. But I'm not sure to set up everything right.
Thanks.
Upvotes: 3
Views: 290
Reputation: 1104
The issue was simple.
I've upgraded @ngrx/store
to version 2 (2.0.1) and it works.
Upvotes: 1