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

Bug using ngForm and ngRepeat on the same node #12561

Closed
@kwypchlo

Description

@kwypchlo

consider this example:

<table ng-controller="TestController as ctrl">
    <tbody>
        <tr ng-repeat="person in ctrl.people" ng-form="testForm">
            <td>{{ person.name }}</td>
            <td><button type="button" ng-click="ctrl.remove($index)"></button></td>
        </tr> 
    </tbody>
</table>
function TestController() {
    this.people = [
        {name: 'John'},
        {name: 'Dorothy'},
        {name: 'Charles'}
    ];

    this.remove = function(index) {
        this.people.splice(index, 1);
    }
}

Using remove button fires up the remove function from the controller, removes one person from the people collection but the row remains displayed, yet without any data. Removing ngForm directive from the <tr> that has ngRepeat resolves the issue, however I need that ngForm there in my case :)

I couldn't get a fiddle or codepen working, dunno why but the example should be simple enough. Tested on 1.4.1 but haven't seen any changes since then in changelog that could suggest it was fixed anyhow.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions