expo go我正在尝试使用和为我的 React Native 应用程序进行数据备份expo-file-system
await Filesystem.writeAsStringAsync(
Filesystem.documentDirectory! + "GymTracker-Data.json",
JSON.stringify(exportData)
)
Run Code Online (Sandbox Code Playgroud)
如何使用或 等documentDirectory文件浏览器应用程序访问此内容?File ManagerAmaze File Manager
我尝试打印应用程序上的路径,但找不到所述路径。
错误信息:
错误 NullInjectorError:R3InjectorError(AppModule)[AlertPanelComponent -> AlertPanelComponent -> AlertPanelComponent]:NullInjectorError:没有 AlertPanelComponent 的提供程序!角
我不明白这一点,我只是想AlertPanelComponent从alert-panel.component 导入我的。
在 stackOverflow 上搜索时,这个错误似乎非常广泛。我已将其放入我的 app.module 中。
应用程序组件.ts
import {AlertClass} from './models/alert-class.model';
...
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit, DoCheck {
...
constructor( private restService:RestService,
private sanitizer: DomSanitizer,
private router:Router,
private alertPanelComponent:AlertPanelComponent ){
}
...
}
Run Code Online (Sandbox Code Playgroud)
应用程序模块.ts
import { AlertPanelComponent } from './alert-panel/alert-panel.component';
...
@NgModule({
declarations: [
AlertPanelComponent,
...
],
...
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)
应用程序路由.module.ts
import { NgModule } …Run Code Online (Sandbox Code Playgroud)