code: function getNearest($select, value) {
          var delta = {};
          angular.forEach($select.children('option'), function(opt, i){
            var optValue = angular.element(opt).attr('value');
  
            if(optValue === '') return;
            var distance = Math.abs(optValue - value); 
            if(typeof delta.distance === 'undefined' || distance < delta.distance) {
              delta = {value: optValue, distance: distance};
            } 
          }); 
          return delta.value;
        }
docs: function to find nearest value in select options