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.

ngMessages blows up when there are duplicate child ngMessage keys #9338

Closed
@niallsmart

Description

@niallsmart

The ngMessages directive gets into an invalid state and throws an exception when there are duplicate ngMessage child keys specified. For example:

<div ng-messages="form.id.$error">
  <div ng-message="required">
    User ID is required.
  </div>
  <div ng-message="required">
    User ID is required.
  </div>
</div>

The issue seems to be a bug in the re-ordering logic in registerMessage which is attempting to preserve the ordering from an included template, but in this scenario inserts null into messages.

Test case here: http://plnkr.co/edit/7u4oFTGbeLqa1tmfMNlJ (look at the console log).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions