如何在另一个组件中渲染组件?当不使用其他组件渲染时,此组件可以正常工作。
Exception:
Dashboard.module.ts
App.module.ts
仪表板:
无法在此处使用组件。
SiteComponent.ts
最终站点组件具有表
<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>
如果该组件仅在DashboardModule
中使用,请将其从app.module
中删除,并同时包含在DashboardModule和declarations
的entryComponents
数组中。
@NgModule({
declarations: [ SiteSearchComponent ],
entryComponents: [ SiteSearchComponent ]
})