Having an issue with displaying a preselected value as the selected option in my select element. Check out the code below:
<select ng-model="data.company" ng-options="company as company.name for company in companies"></select>
$scope.companies =[{
id:1,
name:"Company 1"
},
{
id:2,
name:"Company 2"
}];
$scope.data = {
company:{
id:2,
name:"Company 2"
}
}
The problem I'm facing is that when I enter the section, the select shows me a blank option by default instead of "Company 2". What am I doing wrong?