通过UI网格cellTemplate正确渲染渲染指令 [英] Directive rendered via UI-Grid cellTemplate rendering incorrectly

查看:197
本文介绍了通过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;
    // ...
  });
}

这里

这篇关于通过UI网格cellTemplate正确渲染渲染指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆