Q:

Select an option in select box which has a filter Angularjs

I'm trying to select a particular option in the second select box based on database value. This second select box has a filter applied in it. This gets filtered based on the option selected in first select box
Below is the HTML snippet:
<select id="select_comptype" class="ticketselectboxwidth select-style" ng-model="t_selectedcomptype" ng-options="comptype.ComplaintTypeName for comptype in complainttypemappinglist |  filter: {ComplaintCategoryName: t_selectedcomplaintcategory.ComplaintCategoryName}"></select>  

How can i set the second select box value based on the value ($scope.ticketdetailforid.ComplaintType) which comes from a database ? I've tried the below code but it didn't work. 
 $scope.t_selectedcomptype = $filter('filter')($scope.complainttypemappinglist, { ComplaintTypeName: $scope.ticketdetailforid.ComplaintType })[0];

Any help highly appreciated. Thanks

A:

Found the problem. The issue is with the data. Same complaint type can exist for two or more complaint categories. But I filtered only based on complain type while setting the select box. Adding complaint category in filter resolved the problem. Please find the change below.
$scope.t_selectedcomptype = $filter('filter')($scope.complainttypemappinglist, { ComplaintTypeName: $scope.ticketdetailforid.ComplaintType, ComplaintCategoryName: $scope.ticketdetailforid.ComplaintCategory })[0];

