PillowPillow / ng2-webstorage

Localstorage and sessionstorage manager - Angular service
MIT License
428 stars 92 forks source link

No provider for StrategyIndex! #102

Closed shalakadeshpande closed 5 years ago

shalakadeshpande commented 5 years ago

Using "ngx-webstorage": "3.0.2" with angular 7 setup in my app, I am getting following error on startup - Note. Tried using "ngx-webstorage": "3.0.0-beta.10" as well as per thread here - https://github.com/PillowPillow/ng2-webstorage/issues/94 , still the same issue is seen.

Error: StaticInjectorError(AppModule)[NgxWebstorageModule -> StrategyIndex]: StaticInjectorError(Platform: core)[NgxWebstorageModule -> StrategyIndex]: NullInjectorError: No provider for StrategyIndex! at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:3228) at resolveToken (core.js:3473) at tryResolveToken (core.js:3417) at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:3314) at resolveToken (core.js:3473) at tryResolveToken (core.js:3417) at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:3314) at resolveNgModuleDep (core.js:19784) at _createClass (core.js:19831) at _createProviderInstance (core.js:19801)

PillowPillow commented 5 years ago

Hi, It seems that angular doesn't know about the indexer which is declared during the forRoot call. Without more informations (like your root module declaration) i cant really help you. Please check the readme and the sample project (in the src directory) and verify if you didn't forget anything.

shalakadeshpande commented 5 years ago

Hi, Thanks for your prompt reply, really appreciate,

I am using the module initialization in following way -

import { NgxWebstorageModule } from 'ngx-webstorage'; ... @NgModule({ imports: [CommonModule, HttpClientModule, FormsModule, ... NgxWebstorageModule.forRoot() ...})

Kindly let me know anything else I can add to the detail. Thanks!

shalakadeshpande commented 5 years ago

I found that it was missing BrowserModule import. Closing the thread here, Thanks!