删除angularjs下拉列表中的未定义值

I am using angularjs(ng-options) to create a select dropdown that is populated using a sql query in php to return my list of options as json.

This works great for 1 dropdown..I am now trying to add a second dropdown that uses a different query. I use php array_merge to merge the 2 query result arrays, then json_encode the merged array.

Both dropdowns populate, but both have a lot of unwanted undefined values and I am not sure why..The undefined values do not exist when I only return 1 singular array (rather than merging the two)

I don't have any undefined result objects in the json itself. Only in the select dropdown

 getInfo();
function getInfo(){
// Sending request to EmpDetails.php files 
$http.post('databaseFiles/options.php').success(function(result){
// Stored the returned data into scope 
$scope.options = result;
console.log(result);
});
}
<select class="form-control" ng-model="selectedDepartment" 
        ng-options="option.id as option.department for option in options ">
    <option value="">Select Department</option>
</select>  

</div>

Ended up fixing my issue by adding a filter to my ng-options to remove undefined values

<select class="form-control" ng-model="selectedDepartment" 
        ng-options="option.id as option.department for option in options  **| filter : { id : '!!' }** " >
    <option value="">Select Department</option>
</select>  

</div>