ionic-team / ionic-storage

Ionic Storage module for Ionic apps
MIT License
437 stars 99 forks source link

Update README for Angular users #318

Open veronicadip opened 6 months ago

veronicadip commented 6 months ago

The introduction of standalone components in Angular v14 has changed how dependencies are added. Providing an updated example would be helpful for users. Here's a sample of how this can be done:

In the main.js file:

import { IonicStorageModule } from '@ionic/storage-angular';
import { Drivers } from '@ionic/storage';

//...

bootstrapApplication(AppComponent, {
  providers: [
    //...
    importProvidersFrom(IonicStorageModule.forRoot({
      name: "exampledb",
      driverOrder: [Drivers.IndexedDB]
    }))
  ],
});
brandon-bt commented 5 months ago

To echo and reiterate the above, users developing an Ionic app using standalone components, which is now part of the Ionic official documentation, and then attempting to implement storage as currently defined in this repo's README, will not be able to successfully implement storage without errors.