JC Borlagdan JC Borlagdan - 9 months ago 30
AngularJS Question

How to dynamically make the option selected if it's equal to something?

I'm not good at jQuery or HTML I want to select the option depending on the value passed from an ajax call. The following is what's inside my html

<label class="item item-input">
<input id="" type="text" required ng-model="Data.CompanyTitle">
<select style="width: 100%">

passes either Partner, System or Council. I want the option to be selected depending on what the value of


You can give the select a model and if the value of the option is equal to your variable it gets auto selected

<select ng-model="selectModel">
    <option value="dummy">dummy</option>

and when you set $scope.selectModel = 'dummy' you can see dummy selected