I have the following angular array for one of my select tags
var names= [{name: 'Superman', val: '1'}, {name: 'Batman', val: '2'}];
$scope.names =names;
$scope.FormData = {};
$scope.FormData.name = $scope.names[1];
In the above array, instead of selecting the item by index (1), how can I select the item by name or the val, like
$scope.FormData.name = $scope.names['2']; #will select the {name: 'Batman', val: '2'}
I initially posted a lengthy question here, but then I realized this is the more simpler / focus way of my question
ng-optionscorrectly. Need more details about problem