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.

Ng-model doesn't initialize properly when a select option's value is set using curly braces #12668

Closed
@distinctdan

Description

@distinctdan

Hi,

I'm trying to use ng-model with an html select. However, I'm using curly braces to set each option's value to a scope variable (An enum, specifically). Unfortunately, my select's default option never gets selected when the page loads. I suspect that ng-model runs before the values get interpolated.

Here's my plunker: http://plnkr.co/edit/Q3yM8t53PdpN1pG64T52?p=preview

I would use ng-options, but in our real app, each option has an ng-if to hide it, depending on the user's permissions. Also, unfortunately I can't build an options array in the controller, because it needs to be in the html template for our translation process to work.

Thanks!

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