Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

ng-repeat-start doesn't clean old view when model change #3925

Closed
khtwo opened this issue Sep 8, 2013 · 2 comments
Closed

ng-repeat-start doesn't clean old view when model change #3925

khtwo opened this issue Sep 8, 2013 · 2 comments

Comments

@khtwo
Copy link

khtwo commented Sep 8, 2013

angular-1.2.0-rc.2

<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>

When click "Change Items1", the old rendered boxes were not get clean up.

@rodyhaddad
Copy link
Contributor

This is the same as #3104

@petebacondarwin
Copy link
Contributor

Here's a live repro: http://plnkr.co/edit/rY5UiylxbdRYK8DsWYZG. Probably a similar problem to #3104 but a slightly different case that is worth tracking. Closing this in favour of the former.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants