【发布时间】:2019-01-30 01:34:06
【问题描述】:
我是 UI 技术的新手。 我正在尝试创建一个带有选项卡的 HTML 页面,两个选项卡都将以相同格式的表格显示不同的数据。有没有办法可以保存表格格式,用不同的值填充它并为每个选项卡呈现它们? 感谢期待任何帮助或提示。
这是我的代码:
<div ng-cloak="" class="container" ng-app="MyApp" ng-controller="MyAppControler" ng-init="init()">
<h1></h1>
<md-content>
<md-tabs md-dynamic-height="" md-border-bottom="">
<md-tab label="Teachers">
<md-content class="md-padding">
<table class="table table-striped" >
<colgroup>
<col width="" />
<col width="" />
</colgroup>
<thead>
<tr>
<th width="100">Name</th>
<th width="260">Address</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="Name in teacherNameList">
<td>{{name}}</td>
<td>{{Address}}</td>
</tr>
</tbody>
</table>
</md-content>
</md-tab>
<md-tab label="Students">
<md-content class="md-padding">
<table class="table table-striped">
<colgroup>
<col width="" />
<col width="" />
</colgroup>
<thead>
<tr>
<th width="100">Name</th>
<th width="260">Address</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="Name in studentNameList">
<td>{{name}}</td>
<td>{{Address}}</td>
</tr>
</tbody>
</table>
</md-content>
</md-tab>
</md-tabs>
</md-content>
【问题讨论】:
-
将表格设为组件,然后将项目集合作为参数传递。
-
关于如何在控制器和 html 中组织它的任何代码片段
标签: angularjs html angularjs-material