Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery ngRepeat的AngularJS更新输出_Jquery_Angularjs_Angularjs Ng Repeat - Fatal编程技术网

Jquery ngRepeat的AngularJS更新输出

Jquery ngRepeat的AngularJS更新输出,jquery,angularjs,angularjs-ng-repeat,Jquery,Angularjs,Angularjs Ng Repeat,我有一张桌子,我用它展示产品和细节 我还有一个指示 .directive('onFinishRenderFilters', function ($timeout) { return { restrict: 'A', link: function (scope, element, attr) { if (scope.$last === true) { $timeout(function () {

我有一张桌子,我用它展示产品和细节

我还有一个指示

.directive('onFinishRenderFilters', function ($timeout) {
    return {
        restrict: 'A',
        link: function (scope, element, attr) {
            if (scope.$last === true) {
                $timeout(function () {
                    scope.$emit('ngRepeatFinished');
                });
            }
        }
    }
})
我用它来修复html css样式

$scope.$on('ngRepeatFinished', function (ngRepeatFinished) {

if($(".row0_fixed").outerHeight()>($(".row0").outerHeight())){
  $(".row0").outerHeight($(".row0_fixed").outerHeight());
}else{
  $(".row0_fixed").outerHeight($(".row0").outerHeight());
}

if($(".row1_fixed").outerHeight()>($(".row1").outerHeight())){
  $(".row1").outerHeight($(".row1_fixed").outerHeight());
}else{
  $(".row1_fixed").outerHeight($(".row1").outerHeight());
}

if($(".row2_fixed").outerHeight()>($(".row2").outerHeight())){
  $(".row2").outerHeight($(".row2_fixed").outerHeight());
}else{
  $(".row2_fixed").outerHeight($(".row2").outerHeight());
}

if($(".row3_fixed").outerHeight()>($(".row3").outerHeight())){
  $(".row3").outerHeight($(".row3_fixed").outerHeight());
}else{
  $(".row3_fixed").outerHeight($(".row3").outerHeight());
}

if($(".row4_fixed").outerHeight()>($(".row4").outerHeight())){
  $(".row4").outerHeight($(".row4_fixed").outerHeight());
}else{
  $(".row4_fixed").outerHeight($(".row4").outerHeight());
}

if($(".row5_fixed").outerHeight()>($(".row5").outerHeight())){
  $(".row5").outerHeight($(".row5_fixed").outerHeight());
}else{
  $(".row5_fixed").outerHeight($(".row5").outerHeight());
}

if($(".row6_fixed").outerHeight()>($(".row6").outerHeight())){
  $(".row6").outerHeight($(".row6_fixed").outerHeight());
}else{
  $(".row6_fixed").outerHeight($(".row6").outerHeight());
}

if($(".row7_fixed").outerHeight()>($(".row7").outerHeight())){
  $(".row7").outerHeight($(".row7_fixed").outerHeight());
}else{
  $(".row7_fixed").outerHeight($(".row7").outerHeight());
}

if($(".row8_fixed").outerHeight()>($(".row8").outerHeight())){
  $(".row8").outerHeight($(".row8_fixed").outerHeight());
}else{
  $(".row8_fixed").outerHeight($(".row8").outerHeight());
}

if($(".row9_fixed").outerHeight()>($(".row9").outerHeight())){
  $(".row9").outerHeight($(".row9_fixed").outerHeight());
}else{
  $(".row9_fixed").outerHeight($(".row9").outerHeight());
}
});
}])
问题是如果我从范围中删除了一个产品,指令就不会再次运行,样式也会被破坏


提前感谢

解决方案是在$scope中添加$watch,并使用jquery查看outerHeight是否正在更改并修复它

这是我用来解决这个问题的部分代码

$scope.$watch(function(){
   return $(".row0").outerHeight();
},function(){
  fixTable();
});

如果我从范围中删除了一个产品,指令就不会再次运行,这就是重复的美妙之处;你想要的最终结果是什么?谢谢你@jacob,我只是想再次调整行的外光,但我不知道我怎么能做到。不是做个混蛋,但这不是最终结果。我希望表格的最后一行是其他行高度的1.5倍。谢谢你@jacob在你的帮助下,我找到了解决方案。