在其他模块中使用模块时,覆盖内容

时间:2019-05-29 09:29:35

标签: angular module components

我需要通过ReportComponent选择器在另一个组件(ContactsComponent)中使用一个组件(<app-reports>)。

对于这两个组件,我都在使用模块,因此,当我尝试将ReportModule导入到ContactsDetailsModule中时,碰巧ContactDetailsComponent的内容被{ {1}}内容(即使不使用html选择器)。

这是report.module.ts

ReportComponent

这是contacts-datails.module.ts

import { NgModule } from '@angular/core';
import { CommonModule, DatePipe } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { UiSwitchModule } from 'ngx-toggle-switch';
import { ToastrModule, ToastrService } from 'ngx-toastr';
import { QuillModule } from 'ngx-quill';
import { ReportComponent } from './report.component';
import { sanitizeHtmlPipe } from './sanitize-html.pipe';
import { BrowserModule } from '@angular/platform-browser';

const routes: Routes = [
  {
    path: '',
    data: {
      title: 'Report',
      urls: [
        { title: 'Dashboard', url: '/dashboard' },
        { title: 'Report' }
      ]
    },
    component: ReportComponent
  }
];

@NgModule({
  imports: [FormsModule, CommonModule, RouterModule.forChild(routes), NgbModule.forRoot(), QuillModule, UiSwitchModule, ToastrModule.forRoot()],
  declarations: [ReportComponent, sanitizeHtmlPipe],
  exports: [ReportComponent, sanitizeHtmlPipe],
  providers: [DatePipe, ToastrService]
})
export class ReportModule {}

您能帮助我了解我在做什么吗?

0 个答案:

没有答案
相关问题