I'm trying to filter a selection list:
<div ng-controller="Ctrl">
<select ng-model="targetToMap" required="true"
ng-options="code.instructions_short for code in targetCodes |filter:targetCodes.environment=2"
></select>
<div>
var app = angular.module('app', []);
function Ctrl($scope) {
$scope.targetCodes = [
{"fid":"1","environment":"1","instructions_short":"Script1.1"},
{"fid":"2","environment":"1","instructions_short":"Script1.2"},
{"fid":"3","environment":"1","instructions_short":"Script1.3"},
{"fid":"4","environment":"1","instructions_short":"Script1.4"},
{"fid":"5","environment":"2","instructions_short":"Script2.1"},
{"fid":"6","environment":"2","instructions_short":"Script2.2"},
{"fid":"7","environment":"2","instructions_short":"Script2.3"},
{"fid":"8","environment":"2","instructions_short":"Script2.4"}
];
}
For some reason the filter appears to applying to both FID and ENVIRONMENT, so it returns a list including fid=2 as well as the 4 records where environment=2. I put the filter inline to simplify the code. What's wrong with this picture?
A jsfiddle can be found here: jsfiddle