类型“typeof NgxJsonLdModule”上不存在属性“forRoot”

Geo*_*ugu 2 npm angular-universal angular

我已经安装了这个包@ngx-lite/json-ld。试图使我的 SEO schema.org 动态化。在导入本教程中指定的模块时,我收到此错误:

src/app/app.module.ts(18,21) 中的错误:错误 TS2339:“typeof NgxJsonLdModule”类型上不存在“forRoot”属性。

这是我的 app.module

import { NgtUniversalModule } from "@ng-toolkit/universal";
import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";

// Third Party library
import { NgxJsonLdModule } from "@ngx-lite/json-ld";

import { AppComponent } from "./app.component";
import { AppRoutingModule } from "./app-routing.module";
@NgModule({
  declarations: [AppComponent],
  imports: [
     AppRoutingModule,
     NgtUniversalModule,
     NgxJsonLdModule.forRoot()
  ],
  providers: []
})
export class AppModule {}
Run Code Online (Sandbox Code Playgroud)

我正在使用 angular 6.1.9 和 Angular Universal。

wil*_*ent 6

这个特定的包(来源在这里)不提供任何服务,所以它不需要导入时的 forRoot 方法。

你可以像这样导入它:

@NgModule({
  declarations: [AppComponent],
  imports: [
     AppRoutingModule,
     NgtUniversalModule,
     NgxJsonLdModule
  ],
  providers: []
})
export class AppModule {}
Run Code Online (Sandbox Code Playgroud)