1

I get my data from the server and show it in a select drop down.

<select ng-model="selectedProject" ng-options="proj as proj.Name for proj in projects" ng-change="onSelectChange()"></select>

Is there a way to not show a specific proj? For example,

if (proj.Id != currentProject.Id)

The drop down basically shows all the projects, and I want to show all the projects except the current one. Is this possible with the <select>? Or do I need to use ng-repeat?

Crystal
  • 28,460
  • 62
  • 219
  • 393

2 Answers2

0

Use filters

<select ng-model="selectedProject" 
        ng-options="proj as proj.Name for proj in projects | filter:{ Id : currentProject.Id }" 
        ng-change="onSelectChange()"></select>
vittore
  • 17,449
  • 6
  • 44
  • 82
0

with the help of your guys comments and answers, I did this:

options = "proj as proj.Name for proj in projects | filter:selectItems"

$scope.selectItems = function (item) {
   return item.Id != $scope.currentProject.Id;
}
Crystal
  • 28,460
  • 62
  • 219
  • 393