title: How to share a module between a parent and child module in Angular
body: <p>I'm new to Angular. I want to use a component (FuncionariosAlteraSenhaComponent) with routing and with a dialog. However I can't import a component in different modules.</p>
  
  <p>I've created a shared.module to import the FuncionariosAlteraSenhaComponent, to be used in others modules. These two modules are AppLogged.module and Funcionarios.module. AppLogged.module is a parent of the Funcionarios.module.</p>
  
  <p>Shared.module</p>
  
  <pre><code>import { NgModule } from '@angular/core';
  import { CommonModule } from '@angular/common';
  import { FuncionariosAlteraSenhaComponent } from '../features/funcionarios/funcionarios-altera-senha/funcionarios-altera-senha.component';
  
  
  @NgModule({
    entryComponents:[
      FuncionariosAlteraSenhaComponent],
  
    declarations: [
      FuncionariosAlteraSenhaComponent
    ],
    imports: [
      CommonModule
    ],
    exports:[
      FuncionariosAlteraSenhaComponent
    ]
  })
  
  export class SharedModule { }
  </code></pre>
  
  <p>AppLogged.module</p>
  
  <pre><code>@NgModule({
  
    entryComponents: [AppLogedComponent, PesquisaColaboradorComponent, EfetuarPagamentoComponent,
    PesquisaClienteComponent, PesquisaPedidoComponent, CotacaoVendaComponent, CadastroVeiculoComponent,
    PesquisaVeiculoComponent, CompraComponent, CadastroClienteComponent, SolicitarTransferenciaComponent,
    SaidaTransferenciaComponent, ConfirmarRecebimentoComponent, PesquisaEstoqueComponent,TextoLivreComponent,
    DetalheRecebimentoComponent, PesquisaPedCompraTransfComponent,  EfetuarPagamentosComponent],
  
    imports: [
      CommonModule,
      MatRadioModule,
      RouterModule,
      HttpClientModule,
      ReactiveFormsModule,
      FormsModule,
      MatFormFieldModule,
      MatInputModule,
      MatTabsModule,
      MatPaginatorModule,
      MatTableModule,
      MatSortModule,
      MatButtonModule,
      MatCheckboxModule,
      MatDatepickerModule,
      MatNativeDateModule,
      MatExpansionModule,
      MatOptionModule,
      MatSelectModule,
      LayoutModule,
      MatToolbarModule,
      MatSidenavModule,
      MatIconModule,
      MatListModule,
      MatAutocompleteModule,
      AppLogedRoutingModule,
      MatDialogModule,
      MatMenuModule,
      NgxCurrencyModule,
      NgxMaskModule.forRoot(),
    ],
  
  
    declarations: [AppLogedComponent, MenuSideComponent, HeaderComponent, PesquisaColaboradorComponent,
    EfetuarPagamentoComponent, PesquisaClienteComponent, PesquisaPedidoComponent, CotacaoVendaComponent,
    CadastroVeiculoComponent, PesquisaVeiculoComponent,CompraComponent,CadastroClienteComponent,
    SolicitarTransferenciaComponent, SaidaTransferenciaComponent, ConfirmarRecebimentoComponent,
    PesquisaEstoqueComponent,TextoLivreComponent, DetalheRecebimentoComponent, PesquisaPedCompraTransfComponent,  EfetuarPagamentosComponent],
  
    exports: [AppLogedComponent],
  })
  
  export class AppLogedModule { }
  </code></pre>
  
  <pre><code>Funcionarios.module
  
  @NgModule({
    entryComponents: [FuncionariosComponent, ],
    declarations: [FuncionariosComponent, ],
    bootstrap: [FuncionariosComponent, ],
    exports: [ FuncionariosComponent,  ],
    imports: [
      CommonModule,
      ReactiveFormsModule,
      NgxMaskModule,
      FormsModule,
      RouterModule,
      MatFormFieldModule,
      MatInputModule,
      MatPaginatorModule,
      MatTableModule,
      MatSortModule,
      MatButtonModule,
      MatCheckboxModule,
      MatDatepickerModule,
      MatNativeDateModule,
      MatExpansionModule,
      MatOptionModule,
      MatSelectModule,
      MatDialogModule,
      MatRadioModule,
      MatCardModule,
      FuncionariosRoutingModule,
      MatAutocompleteModule,
      SharedModule ],
  })
  export class FuncionariosModule { }
  
  </code></pre>