【问题标题】:Failed: Invalid provider for the NgModule 'DynamicTestModule' - only instances of Provider and Type are allowed, got: [[object Object]?]失败:NgModule 'DynamicTestModule' 的提供程序无效 - 只允许提供 Provider 和 Type 的实例,得到:[[object Object]?]
【发布时间】:2021-05-12 13:25:14
【问题描述】:

所以这个令人愉快的错误就是令人讨厌的定义

这是描述方法:

beforeEach(async(() => {
TestBed.configureTestingModule({
  declarations: [ MapMap ],
  imports: [IonicStorageModule.forRoot()],
  providers: [PopoverController, AngularDelegate, UrlSerializer, File]
  }).compileComponents();

首先它没有提供者,但后来抱怨它需要这些提供者。添加这些提供程序后,它产生了错误

“失败:NgModule 'DynamicTestModule' 的提供程序无效 - 只允许提供 Provider 和 Type 的实例,得到:[..., ..., ..., ..., ..., ?[object目的]?] "

我试图寻找答案,但找不到任何东西

【问题讨论】:

    标签: angular ionic-framework karma-jasmine jasmine-node jasmine2.0


    【解决方案1】:

    只需在 "import { File } from '@ionic-native/file' 的末尾添加 "ngx"; "

    【讨论】:

      猜你喜欢
      • 2016-12-16
      • 2018-09-22
      • 1970-01-01
      • 1970-01-01
      • 2017-06-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-23
      相关资源
      最近更新 更多