I am trying to set select list value from angular JS,which doesn't throw any exception but doesn't reflect any changes either. This is my jsp code.
<select class="form-control " id="searchCriteriaList"
name="searchCriteriaList" ng-model="searchCriteriaSelect" required>
<option>IMEI</option>
<option>Registration Number</option>
</select>
This is my angularJS code
var selectedValue = "IMEI";
$scope.searchCriteriaSelect = selectedValue;
This shows a blank select list. Although this code works
$scope.searchCriteriaSelect = "IMEI";
and select list shows IMEI option on page load.
But I can't assign hardcoded values. It has to be through a variable as data comes from ajax request in my code.
Please help me. Thanks in advance.
searchCriteriaList[0]or perhaps when you get the result of yourajaxcall, you then assign the model value to the first index?