Here is my Angular code:
angular.module("myApp",[])
.controller("myCtrl",function($scope){
$scope.projectObj = {"proId":"33","proName":"samal"}
$scope.projectArr = [{"proName":"samal","proId":"33"},{"proName":"aaa","proId":"47"},{"proName":"sdf","proId":"48"},{"proName":"sdf","proId":"49"},{"proName":"sddd","proId":"50"},{"proName":"dddd","proId":"51"},{"proName":"ttt","proId":"52"},{"proName":"sdf","proId":"53"},{"proName":"sdf","proId":"54"},{"proName":"sdf","proId":"55"},{"proName":"sdf","proId":"56"},{"proName":"sdf","proId":"57"},{"proName":"sdf","proId":"58"},{"proName":"sdf","proId":"59"},{"proName":"sdf","proId":"60"}]
})
Next, I have a select box:
<select ng-model="projectObj">
<option value="{{item}}" ng-repeat="item in projectArr">{{item.proName}}</option>
</select>
I already have $scope.projectObj assigned with an object and it is already inside $scope.projectArr. My goal is to pre-select the proName
when loading the HTML file. How can I achieve this? Here is the link to my example on Plunker.