Search code examples
javascriptangularjshtml-selectng-options

Binding ng-options with a default value that is dynamic from the server


I have multiple AngularJS select drop-down which can be set to a boolean value.

The initial data is driven from the server and I want to set the selected value of the drop down to the server value.

At the moment I get three options to select when the selected option should be the one from the server.

I have set up a Plunker here:

https://next.plnkr.co/edit/bdiX5AA7jtgSLaP6

Which demonstrates the issue.


Solution

  • OK, got it.

    The drop downs were showing empty on load because of your track by in ng-options. Not sure why you had that but it's what broke it: https://next.plnkr.co/edit/fs9q5sAtNL3saKNQ