且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用angularjs从数据库动态添加列

更新时间:2023-11-30 22:11:52

这是我想出的解决方案。通常,我想知道如何在ng-repeat中添加多个过滤器。我已经添加了。

This is the solution that I have come up with. Mostly I wanted to know how add multiple filters in ng-repeat. I have added that.

<div class="col-md-12 table-responsive">
                    <table class="table table-bordered table-striped table-condensed" style="width:50%">
                        <thead>
                            <tr class="bg-info">
                                <th >Name</th>
                                <th ng-repeat='header in names'>{{header}}</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr ng-repeat='p in properties'>
                                <td>{{p}}</td>
                                <td ng-repeat='item in totalData | filter : {property : p}: true | filter : {name : header} : true''>{{item.value}}</td>
                            </tr>
                        </tbody>
                    </table>
                </div>

如果有人有更好的解决方案,我将很乐意实施。

If anyone has a better solution, I will be happy to implement it.