Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body ng-app="app" ng-controller="ctrl">
  <select ng-options="indexBy1(i)+ ' - ' + item for (i, item) in arr" ng-model="selected"></select>
  
  <select ng-options="(i|plus1) + ' - ' + item for (i, item) in arr" ng-model="selected2"></select>
</body>
</html>
 
var app = angular.module('app', []);
app.filter('plus1', function() {
  return function(input) {
    var i = parseInt(input, 10);
    return i+1;
  };
});
app.controller('ctrl', function($scope) {
  $scope.arr = ['item1', 'item2', 'item3'];
  $scope.selected = $scope.arr[0];
  $scope.selected2 = $scope.arr[0];
  
  $scope.indexBy1 = function(index) {
    var i = parseInt(index, 10);
    return i+1;
  };
});
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers