This specific scenario
My attempt to change the selected value in the dropdown from the controller isn't working as expected, despite following guidance from various questions on this platform. The only unique aspect in my case is that I have a default value set using ng-init. How can I successfully update the value from the controller?
HTML Structure:
<select ng-model="storeorder" ng-init="storeorder = 0" ng-change="storeOrderChange(storeorder)">
<option value="0">-- All orders --</option>
<option ng-repeat="obj in orders" value="{{ obj.id }}">{{ obj.name }}</option>
</select>
Javascript Function Logic:
$scope.orders = data;
$scope.storeorder = parseInt($scope.order); // Attempted without parseInt as well
The console.log($scope.storeorder)
displays the correct value, but it doesn't reflect the intended value in the browser.