Currently, I have a drop-down menu populated with States from JSON data:
<select name="ParentState" ng-model="selectedState" ng-options="s.StateID as s.StateCode for s in cStates | orderBy:'StateCode'">
<option value="">Select State...</option>
</select>
I am trying to programmatically set the selected state based on the logged-in user's information using Angular. However, my current approach does not seem to be working as expected.
angular.forEach($scope.cState, function (s) {
if (s.StateCode == xParentState) {
$scope.selectedState = s.StateCode;
}
});
xParent
represents the initials of the state, for example, 'MI' for Michigan.