在组件B角度

时间:2019-10-14 08:01:05

标签: angular angular-ui-router

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

例外:

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>

1 个答案:

答案 0 :(得分:1)

如果该组件仅在DashboardModule中使用,请将其从app.module中删除,并确保它同时存在于DashboardModule和declarations的{​​{1}}数组中。

entryComponents