尝试在我的离子应用程序中使用存储版本 2.1.3 但出现错误:
NullInjectorError: R3InjectorError(AppModule)[AppModule -> Storage -> Storage -> Storage]: NullInjectorError: No provider for Storage! ionic 6
Run Code Online (Sandbox Code Playgroud)
我看到一些关于它的帖子,告诉我们使用 forRoot 语句,但无论如何都不起作用。
我的应用程序模块:
import { NgModule, OnInit } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { IonicStorageModule } from '@ionic/storage'
import {HttpClientModule} from '@angular/common/http'
@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [BrowserModule, HttpClientModule, IonicModule.forRoot(), IonicStorageModule.forRoot(), …Run Code Online (Sandbox Code Playgroud)