http://stackoverflow.com/questions/33445697/select-an-option-in-ng-options-not-working-with-jquery
Fiddle for question; http://stackoverflow.com/questions/33445697/select-an-option-in-ng-options-not-working-with-jquery
by hmartos
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<div ng-controller="MyCtrl as myCtrl">
<select id="selectedDay" name="selectedDay" class="form-control ng-pristine ng-untouched ng-valid" ng-model="selectedDay" tabindex="0" aria-invalid="false">
<option value="?" selected="selected"></option>
<option value="object:35" label="Today">Today</option>
<option value="object:36" label="Tomorrow">Tomorrow</option>
<option value="object:37" label="Sunday">Sunday</option>
</select>
<br/>
<p>Selected day: {{selectedDay}}</p>
</div>
JavaScript
//Module myApp
angular.module('myApp', []);
//Controller
angular.module('myApp').controller('MyCtrl', function ($scope) {
//Changing storedDay to a valid label option changes selected option
$scope.storedDay = 'Today';
//$scope.storedDay = 'Tomorrow';
//Iterate over options
for (var i = 0; i < angular.element(document.querySelector('#selectedDay').children).length; i++) {
if (angular.equals(angular.element(document.querySelector('#selectedDay').children[i]).attr('label'), $scope.storedDay)) {
//Set selected option in ng-model
$scope.selectedDay = angular.element(document.querySelector('#selectedDay').children[i]).attr('value');
}
}
})