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.

form.$invalid: true after ng-repeat array shortening #1312

Closed

Description

@Hoverbear

Demonstration (Not by me):
http://jsfiddle.net/ADukg/117/

If you fill in both inputs, form.$invalid=false.
Then, if you click 'Remove All',form.$invalid=false, as expected.

However, if you fill none, or one input, form.$invalid=true, again, as expected.
But... If we click 'Remove All' after, form.$invalid=true remains, even though there are no fields in the form.

Is there a solution to this?

Activity

  1. laguiz commented on Sep 27, 2012

    @laguiz

    @johnday-github
    I also have issue with splice().
    Can you give an example? I'm not sure to get it.
    Thank you.

  2. laguiz commented on Sep 27, 2012

    @laguiz

    I'm able to fix the issue when we want to splice() an array by doing this :

    //The delete action
    $scope.removeMyChild = function(currentParent, index){
        this.myParentForm.$removeControl(this.myChildForm);
        currentParent.myList.splice(index, 1);
    }

    This is not so nice but it works for me. Maybe AngularJS should handle it automatically?

    Any feedback on this is welcome.

  3. pkozlowski-opensource commented on Nov 25, 2012

    @pkozlowski-opensource
    Member

    Duplicate of #1572

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions