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] ngSelected won't select the option within a ngRepeat #14876

Closed
@brazorf

Description

@brazorf

Do you want to request a feature or report a bug?
Bug.

What is the current behavior?
In 1.5.6 an html <option> with ngSelected seems to have the selected attribute applied, but that option won't highlight. Tried with Chrome.
This happen when using ngSelected in combination with ngRepeat; if used in static <option> elements it works fine.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (template: http://plnkr.co/edit/tpl:yBpEi4).

Example code:

<select ng-model="user.item_id">
      <option ng-selected="i.id == user.item_id" ng-repeat="i in items" value={{i.id}}>
        {{i.name}}
      </option>
</select>

Plunker: https://plnkr.co/edit/7oi4KwzMhGi3kdltSklg?p=preview

What is the expected behavior?
The option should actually get highlighted - like it worked until 1.3.20

Plunker to the working version: https://plnkr.co/edit/0ApQeZ6Kar2yQisELXfT?p=preview

What is the motivation / use case for changing the behavior?
n\a

Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.

Chrome 51.0.2704.103 m
Win 7 Ultimate 64 bit

Other information (e.g. stacktraces, related issues, suggestions how to fix)
n\a

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions