Problem using Storage


#1

Hello! I have a problem using Storage. When I execute “ionic serve” in the terminal work fine but when run the web I can see this error:

Runtime Error
Can’t resolve all parameters for Storage: (?).

In my home.ts I’m using like this:

import { Storage } from '@ionic/storage';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html',
  providers: [Storage]
})
export class HomePage {
    
    constructor(private storage: Storage ...) {
                this.storage = storage;
                ...
	}

Somebody know how can I fix this problem?
Thanks in advance!


#3

Why do you use the provider tag in your @Component(..) ?
You should definitely read the Ionic Storage docs first: https://ionicframework.com/docs/storage/


#4

Thank @LoLStats you are right! my error was the provider tag in my @Component
Thank you very much!