0
<div data-ng-cloak="" data-ng-controller="Controller">
    <a data-ng-click="changeItems1()">Change Items1</a>

    <div data-ng-repeat-start="item1 in model1.items1" style="width:0;height:0;">
    </div>
    <div data-ng-repeat="item2 in model1.items2" style="border:1px #f00 solid;">
        {{ item1 }}, {{ item2 }}
    </div>
    <div data-ng-repeat-end style="display:none;">
    </div>
</div>

<script type="text/javascript">
    function Controller($scope){
        $scope.model1 = {};
        $scope.model1.items1 = [{id:"1"}, {id:"2"}, {id:"3"}, {id:"4"}];
        $scope.model1.items2 = [{id:"1a"}, {id:"2a"}, {id:"3a"}];

        $scope.changeItems1 = function(){
            $scope.model1.items1 = [{id:"1"}, {id:"2"}, {id:"3"}];
        }
    }
</script>

单击“Change Items1”时,旧的渲染框不会被清理。有人知道那里发生了什么吗?

4

1 回答 1

0

好的,这是一个 Angularjs 错误。从 Angularjs 错误板上,他们正在处理几个类似的与 ng-repeat(-start) 相关的缺陷。以下链接详细介绍了这是如何发生的: https ://github.com/angular/angular.js/issues/3104

于 2013-09-08T20:45:51.863 回答