NgModule [object Object] 的提供程序无效 - @awesome-cordova-plugins/file

问题描述 投票:0回答:1

问题在于,尝试迁移到 cap 5,然后对 cordova 包进行了一些更改,更新并使用某些包后出现错误,它始终显示 [object Object] 这是一些 cordova 包的导入。我将这些导入用于页面模块和 ts

import { FileTransfer, FileTransferObject } from '@awesome-cordova-plugins/file-transfer/ngx';
import { File } from '@awesome-cordova-plugins/file/ngx';

然后这是模块页面上的提供者

@NgModule({
...
providers: [FileTransferObject,File],
...
})

当我使用它时它显示错误

ERROR Error: Uncaught (in promise): NullInjectorError: 
R3InjectorError(PdfViewerPageModule)
[[object Object] -> [object Object] -> [object Object] -> [object Object] -> [object Object]]: 
NullInjectorError: No provider for [object Object]!

不知怎的,当我输入

FileTransferObject
时,它又提示了另一个错误

ERROR Error: Uncaught (in promise): Error: Invalid provider for the NgModule 
'PdfViewerPageModule' - 
only instances of Provider and Type are allowed, got: 
[..., ..., ?[object Object]?]

有什么解决方案或我遗漏的某些步骤吗?

谢谢

angular cordova ionic-framework
1个回答
0
投票

尝试将 PdfViewerPageModule 添加到您的提供商

providers: [FileTransferObject,File, PdfViewerPageModule]
© www.soinside.com 2019 - 2024. All rights reserved.