table的头:
<div class="table-responsive" style="margin-top: 20px;">
<table id="table" class="table table-bordered table-hover table-condensed data-list fix-header visitor-table" cellspacing="0" cellpadding="0" style="border: 0;">
<thead>
<tr style="background: rgba(0,0,0,.8); color: #ffffff;">
<th width="25%">标题</th>
<th width="25%">创建人</th>
<th width="25%">创建时间</th>
<th width="25%">接受角色</th>
<!--<th width="25%">操作</th>-->
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
table获取服务器返回数据列表展示:juicer
<script type="tpl" id="role_list_tpl">
{@each list as item,index}
<tr>
<td>&{item.title == null ? '' : item.title}</td>
<td>&{item.personName == null ? '' : item.personName}</td>
<td>&{item.createTime == null ? '' : item.createTime}</td>
<td>
{@if item.isNoticeHirer==1 && item.isNoticeHouseOwner==1}屋主|租户
{@else if item.isNoticeHirer==1}租户
{@else if item.isNoticeHouseOwner==1}屋主
{@else}无
{@/if}
</td>
<#td>
<a class="btn-operate" href="javascript:void(0);" style="cursor: pointer;margin:0 auto;" ng-click="method.selectedUser(&{item.id})">查看详情</a>
<a class="btn-operate" href="javascript:void(0);" style="cursor: pointer;margin:0 auto;" ng-click="method.editUser(&{item.id})">编辑</a>
<a class="btn-operate" href="javascript:void(0);" style="cursor: pointer;margin:0 auto;" ng-click="method.deleteUser(&{item.id})">删除</a>
<#/td>
</tr>
{@/each}
</script>
JS 获取list:(angular的时间格式化$filter
showTables:function (param) {
var params=param||{};
var url='/rest/sysNotice/test';
$timeout(function () {
$("#table").loadList({
url: url,
params: params,
pageSize: 10,
template: 'role_list_tpl',
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
loading: false,
success: function (data, table) {
if(data.success) {
toaster.pop("success", "查询列表", data.message);
$scope.list = data.result;
angular.forEach($scope.list.list,function (item) {
item.createTime=$filter('date')(item.createTime,'yyyy-MM-dd HH:mm');
});
}else{
toaster.pop("error", "查询列表", data.message);
}
$scope.$apply();
},
afterRender: function (dom) {
var $div = dom[0];
var $table = $(".data-header")[0];
angular.element(document).injector().invoke(
function ($compile) {
$compile($div)($scope);
$compile($table)($scope);
});
}
});
})
}