通过UI网格cellTemplate正确渲染渲染指令

通过UI网格cellTemplate正确渲染渲染指令

问题描述:

我遇到一个奇怪的问题,我的指令似乎是陈旧row.entities执行,这意味着当你向下滚动或修改排序网格它没有得到新的值。最初〜20行渲染罚款,但过去该指令成为解除关联的行。

I am experiencing a strange issue in that my directive seems to be executing on stale row.entities, meaning it does not get the new values as you scroll down or modify the sort of the grid. The initial ~20 rows render fine but past that the directives become disassociated with the rows.

请参阅我很一起砍死例如 rel=\"nofollow\">。

See my very hacked together example here.

它看起来像在EX pression传递给指令改变排序值,但前pression本身保持不变。

It looks like during sort values of the expression you pass to directive change, but the expression itself stays the same.

您应该更改范围&安培; 前pression结合 = 值绑定(并访问值与 scope.installs ,没有函数调用),那么你就可以跟踪更改。

You should change scope & expression binding to = value binding (and access the value with scope.installs, without function call), then you will be able to track the changes.

// ...
scope: {
  installs: '='
},
// ...

然后,跟踪你可以使用范围发生变化。$看,把你的code内。

link: function (scope, element, attrs) {
  scope.$watch('installs', function(newValue) {
    // your code, you can use newValue as current installs value
    var installs = newValue;
    // ...
  });
}

这里