在分量B角中渲染分量A

问题描述 投票:1回答:1

如何在另一个组件中渲染组件?当不使用其他组件渲染时,此组件可以正常工作。

Exception:

enter image description here

Dashboard.module.ts

enter image description here

App.module.ts

enter image description here

仪表板:

无法在此处使用组件。

enter image description here

SiteComponent.ts

enter image description here

最终站点组件具有表

<table datatable datatable [dtOptions]="dtOptions"
       [dtTrigger]="dtTrigger" >
<caption> </caption>
   <thead>

    <tr>
      <th>Site</th>
      <th>Customer No.</th>
      <th>Meter S.No</th>
      <th>Modem ID</th>
      <th>Instrument Type</th>
      <th>Instrument No</th>
      <th>Region</th>
      <th>Zone</th>
       <th>Category</th>
       <th>SP Id</th>
       <th>SP Type</th>
      <th>Meter Type</th>
      <th>Address</th>
      <th>Site ID</th>

    </tr>

  </thead>

  <tbody>
 <tr *ngFor="let tbl of sites$">

<td>{{tbl.site_name}}</td>
<td>{{tbl.customer_id}}</td>
<td>{{tbl.meter_serial_no}}</td>
<td>{{tbl.device_id}}</td>
<td>{{tbl.device_type}}</td>


<td>{{tbl.Evc_Serial_No}}</td>
<td>{{tbl.region_name}}</td>
<td>{{tbl.zone_name}}</td>
<td>{{tbl.Category}}</td>
<td>{{tbl.Service_Point_Id}}</td>
<td>{{tbl.Serv_Point_type}}</td>

<td>{{tbl.meter_type}}</td>
<td>{{tbl.Address}}</td>
<td>{{tbl.site_id}}</td>
  </tr>

  </tbody>

  </table>
angular angular-ui-router
1个回答
1
投票

如果该组件仅在DashboardModule中使用,请将其从app.module中删除,并同时包含在DashboardModule和declarationsentryComponents数组中。

@NgModule({
  declarations: [ SiteSearchComponent ],
  entryComponents: [ SiteSearchComponent ]
})
© www.soinside.com 2019 - 2024. All rights reserved.