AngularJS的列表显示

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);
                          });
                   }
                });
            })
        }


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一望损莓苔

一毛钱的动力~yeah~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值