我正在尝试创建一个 Angular 对话框。为此,我将一个组件导入到 Service 类中,但出现以下错误。我正在使用不同的模块并在该模块上添加了一个入口组件
错误:未找到 NewPasswordComponent 的组件工厂。你把它添加到@NgModule.entryComponents 了吗?
新密码/新密码.module.ts
import { NewPasswordRoutingModule } from './newpassword-
routing.module';
import { NewPasswordComponent } from './newpassword.component';
export * from './newpassword.component';
@NgModule({
imports: [
CommonModule,
NewPasswordRoutingModule
FlexLayoutModule.withConfig({addFlexToParent: false})
],
exports: [
NewPasswordComponent
],
declarations: [NewPasswordComponent],
entryComponents: [NewPasswordComponent],
})
export class NewPasswordModule {}
Run Code Online (Sandbox Code Playgroud)
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import {AppRoutingModule} from "./app-routing.module";
import { AppComponent } from './app.component';
import {SomeService} from "./shared/someservice.service";
@NgModule({
declarations: [
AppComponent,
],
imports: [
BrowserModule,
AppRoutingModule,
],
providers: …Run Code Online (Sandbox Code Playgroud)