Angular 需要在子模块中实现翻译。BaseComponent是抽象类,LanguageTranslateService是翻译服务

Angular 需要在子模块中实现翻译。BaseComponent是抽象类,LanguageTranslateService是翻译服务,angular,typescript,Angular,Typescript,我正在尝试在Angular 8应用程序中实现翻译 翻译在所有组件中成功实现,但当我尝试在子组件上实现时,它显示错误: 未定义 App.module的代码 import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { DashboardModule } from './dashboard/dashboard.module'; import { La

我正在尝试在Angular 8应用程序中实现翻译

翻译在所有组件中成功实现,但当我尝试在子组件上实现时,它显示错误:

未定义

App.module的代码

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { DashboardModule } from './dashboard/dashboard.module';
import { LayoutModule } from './layout/layout.module';
import { AppRoutingModule } from './app-routing.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { LoginComponent } from './login/login.component';
import { SharedServicesService } from './SharedServices/shared-services.service';
import { HttpClientModule } from '@angular/common/http';
import { CommonModalsComponent } from './common-modals/common-modals.component';
import { DefineGroupModule } from './define-group/define-group.module';
import { MaterialModuleModule } from './material-module/material-module.module';
import { DefineGroupModalComponent } from './define-group/define-group-modal/define-group-modal.component';

@NgModule({
  declarations: [
    AppComponent,
    LoginComponent,
    ConfirmDialogComponent,
    CommonModalsComponent,
    CustomConfirmModalsComponent,
    DefineGroupModalComponent,
    NewUserPopUpComponent,
    AddNewControllComponent,
    AddEscalationComponent ,
    NumberOnlyDirective
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    DashboardModule,
    DefineGroupModule,
  ],
  exports: [
    LayoutModule,
    DashboardModule,
    FormsModule,
    RouterModule,
    HttpClientModule
    ],
  providers: [SharedServicesService,
    LanguageTranslateService],
  bootstrap: [AppComponent],
  entryComponents: [DefineGroupModalComponent, NewUserPopUpComponent,   
    ConfirmDialogComponent, CommonModalsComponent, CustomConfirmModalsComponent,
    AddNewControllComponent, AddEscalationComponent ]
})
export class AppModule { }
父组件的代码

export class DefineGroupComponent extends BaseComponent implements OnInit {

  constructor(public languageTranslateService: LanguageTranslateService,
              private _svc: SharedServicesService, public dialog: MatDialog,
              private GlobalVariableService: GlobalVariableService) {
    super(languageTranslateService);
   }
HTML代码

  <div class="col-sm">
    <button color="primary" class="ctgrySaveButton pull-right" mat-raised-button
     name='SaveDefineGroup' (click)="NewEdit('New')">
         {{langObject.DefineNewGroup}}
    </button>
  </div>

{{langObject.DefineNewGroup}

我为子组件编写了相同的代码,但由于子组件没有模块,并且在应用程序模块中直接称为其组件,因此它没有获得
语言翻译服务

你说它没有模块是什么意思?每个组件都应该在某些模块中声明Hild组件或popup组件直接在应用程序的entryComponents中声明。模块您是否也尝试将它们添加到“声明”中?子组件没有模块这些是popup模块或对话子组件正在进行良好的翻译service@DPro先生,有什么需要帮忙的吗