gilf / angular2-indexeddb

angular2-indexeddb is a library that wraps indexeddb database in an Angular service.
MIT License
88 stars 44 forks source link

Angular 5 Can't resolve all parameters for AngularIndexedDB #51

Closed hypDev closed 6 years ago

hypDev commented 6 years ago

I am attempting to migrate my Angular 4.x project to 5 and this warning shows. When I upgrade to Angular 5, sure enough it breaks with this error. Is anybody else encountering this?

"Can't resolve all parameters for AngularIndexedDB in C:/Users/peter/git/Hyperion3/MyApp/node_modules/angular2-indexeddb/angular2-indexeddb.ts: (?, ?). This will become an error in Angular v5.x"

hypDev commented 6 years ago

I did not need this to be injectable so I pulled the ts file and removed the @Injectable tag. This made the file compilable and functional in Angular 5. As to why it's thinking the types are not defined in the constructor, I have no idea

gilf commented 6 years ago

The problem is that there is no need for Injectable anymore. I removed it from the class in the last version so please update to the new 1.2.2 version.

Cl3r1k commented 6 years ago

Can you provide the link, where mention about this point: 'there is no need for Injectable anymore' The styleguide tells to use it anyway Style 07-04

gilf commented 6 years ago

@Cl3r1k since the service constructor doesn't include injectables then the Injectable decorator isn't needed. You should use the decorator if there is some sort of dependency injection in the services (or empty constructor or injecting something in the constructor).

giamkk commented 6 years ago

my 'ng build --prod' keep fail. 'ng build --prod' error message: ERROR in : Can't resolve all parameters for AngularIndexedDB in C:/.../node_modules/angular2-indexeddb/angular2-indexeddb.ts: (?, ?).

same as my 'ng serve' error message: Error: Can't resolve all parameters for AngularIndexedDB: (?, ?).

my 'ng serve' can run if i try to add back '@Injectable()' command. what should i do to solved this 'ng build --prod' problem?