0

i am getting a value in json andand want to put that value in selectbox html auto sleceted that in angularjs how can i do this?

Here is my html code

<select class="form-control" name="comregtype"  ng-init="users.comregtype" id="comregtype" ng-options="c.name for c in colors" >
                       <option  ng-selected="users.comregtype"  ></option>
                      <option>Company Registration Type</option>
                           <option>Proprietor</option>
                           <option>Partnership Firm</option>
                           <option>LLP</option>
                           <option>Pvt. Ltd. Co.</option>
                           <option>Ltd. Co.</option>
                        </select>

JS: $scope.users = {comregtype:response.comregtype}

i am gettting value in response.comregtype = "LLP"

How can i set this as seleceted value in selecetbox.

if anyone can help .

Thanks

Shakti Sharma
  • 2,131
  • 3
  • 18
  • 23

1 Answers1

0

You can do this,

  <select ng-model="value" ng-init="value='LLP'"   ng-options="mode.value as mode.value for mode in types.RegistrationType">
  </select>

DEMO

Sajeetharan
  • 216,225
  • 63
  • 350
  • 396