【发布时间】:2020-08-18 07:03:04
【问题描述】:
问题
第二个组件 - 表格 html 显示在菜单下方,但我需要它显示在菜单右侧。
我在 Angular 7 上工作,我有两个组件
第一个组件是左侧菜单中包含的报告组件,它是 app.component 上的路由器出口
第二个组件是table html,存在于reportdetails组件上,点击链接菜单时生成。
第一个组件报告包含菜单
<p>report-category works!</p>
<table *ngFor="let rep of reportlist">
<tr>
<td>{{rep.reportCategory}}</td>
</tr>
<tr *ngFor="let subrep of subreportlist">
<div *ngIf="subrep.reportCategoryID === rep.reportCategoryID">
<a href="/reportdetails?id={{subrep.reportID}}">
<i class="{{subrep.IconClass}}"></i>
<span class="title">{{subrep.reportName}}</span>
</a>
</div>
</tr>
</table>
第二个是报表组件包含显示在菜单下方的表格,这是错误的
我需要的正确方法是如下图所示显示菜单右侧
reportdetails works!
<p>reportdetails works!</p>
<div>
<table class="table table-hover" >
<thead>
<tr>
<th>regulation</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let rep of reportdetailslist">
<td>{{rep.regulation}}</td>
</tr>
</tbody>
</table>
<p>reportdetails works!</p>
<div>
<table class="table table-hover" >
<thead>
<tr>
<th>regulation</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let rep of reportdetailslist">
<td>{{rep.regulation}}</td>
</tr>
</tbody>
</table>
</div>
小提琴链接如下: https://jsfiddle.net/015asjzv/1/
我尝试了什么
table{
float:right;
width:auto;
}
最后更新 看这里的链接
http://www.mediafire.com/view/wnptffqakjglkre/correctdata.png/file
【问题讨论】:
-
你能添加一个工作小提琴吗?
-
谢谢你的回复如何把小提琴放在里面是有角度的
-
您可以在
stackblitz或codesandbox上创建一个工作演示,两者都支持角度 -
我用小提琴更新了帖子
标签: javascript html css angular7 angular-components