Dir Paginate指令在angularjs中附加数据

时间:2016-02-04 14:37:27

标签: javascript jquery angularjs

我正在使用angularJs创建一个应用程序。在我的项目中,我从这里使用dir paginate指令:https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination  我使用下拉列表从api获取数据并传递给视图。但新记录集附加在之前的数据上。 当我使用ng-repreat时,代码工作正常  这是我的代码:

<select class="selectbox_menulist" ng-model="flow.flow_id" ng-change="network.getFlowByID(flow)">
                                <option value="">{{'popup.configureFlowView.form.select' | translate}}</option>
                                <option ng-repeat="flow in flowIds" value="{{flow.id}}">{{flow.id}}</option>
                            </select>

<tr ng-if="contracts.length" dir-paginate="contract in contracts | itemsPerPage: contractsPerPage track by contract.contractid"-->
                                <td>{{contract.contractid}}</td>
                                <td>{{contract.contractStatus}}</td>
                                <td>{{contract.bandwidth}}</td>
                                <td>{{contract["contract-end-time"] | date: 'medium' : actualTimeZone}}</td>
                                <td>{{contract["contract-start-time"] | date: 'medium' : actualTimeZone}}</td>
                                <td>{{contract["renewal-option"] | renewalName | translate}} </td>
                                <td>{{contract.price}}</td>
                                <td><span class="icon_edit anchor" ng-click="network.contract.editContract($event,contract)"></span></td>
                            </tr dir-paginate>

控制器代码是:

networkService.getContracts(linkId).then(function(response){
                        $scope.contracts = response.contracts;
                        console.log($scope.contracts);

                    });

0 个答案:

没有答案