失去了在我看来ngtableparam范围

失去了在我看来ngtableparam范围

本文介绍了失去了在我看来ngtableparam范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某种原因失去IM在我看来ngtable则params的范围内,一切都在ngtableparams是不确定的(我在angularjs batarang绑定见)。

For some reason im losing scope of ngtable params in my view , everything in ngtableparams is undefined ( i see in angularjs batarang binding ).

我的控制器code是

this.contractsParams = new ngTableParams({

        defaultSort: 'asc',
        counts: [],
        total: 10, // length of data
        getData: function ($defer, params) {
            this.MyService.query(
               angular.bind( function (data) {
                 debugger;
                 $defer.resolve(data.Data);
            }));
        }

    });

此外,的getData是没有得到所谓的在所有如初。

also , the getdata is not getting called at all ever.

我的视图

<table ng-table="controller.contractsParams">
<tr ng-repeat="contract in $data">
      <td data-title="'Title'" data-sortable="'Title'">{{contract.Title}}</td>
</tr>

推荐答案

通过增加这一块我认为解决了这个

Resolved this by adding this piece to my view

纳克控制器=作为myController的控制器

ng-controller="myController as controller"

这篇关于失去了在我看来ngtableparam范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 14:38