record.factory 不是 Angular Javascript 页面上的函数错误

lib*_*orn 7 javascript typescript angular

编译我的应用程序并运行时,HTML 页面显示为空白,并且不会显示该应用程序。我能够在 Google Chrome 上使用 Inspect 工具,Chrome 说record.factory 不是一个函数,页面工作正常。然而,我最近确实将我的角度版本更新到了最新版本 - 所以我不确定这是否与它有关。

这是我的 module.ts 代码,我怀疑它与导入有关,通常当我遇到应用程序不显示的问题时就是这种情况:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';  
import { ItemService } from './items.service';
import { NewItemFormComponent } from './new-item-form/new-item-form.component';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input'; 
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule } from '@angular/forms';
import { Platform } from '@angular/cdk/platform';
import { AutofillMonitor } from '@angular/cdk/text-field';
import { ContentObserver } from '@angular/cdk/observers';

@NgModule({
  declarations: [
    AppComponent,
    NewItemFormComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    HttpClientModule,
    MatFormFieldModule,
    MatInputModule,
    BrowserAnimationsModule,
    FormsModule
  ],
  providers: [ItemService, Platform, BrowserModule,
    AppRoutingModule,
    HttpClientModule,
    MatFormFieldModule,
    MatInputModule,
    BrowserAnimationsModule,
    FormsModule, AutofillMonitor, ContentObserver],
  bootstrap: [AppComponent]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

Mar*_*uly 4

我遇到了类似的错误,这篇评论的帖子对我有帮助。当您使用在不同 Angular 版本中编译的包时会发生这种情况:

“必须使用完全相同版本的 Angular 来编译和运行包;不支持任何其他组合,并且可能会以微妙的方式破坏。”