       attrs.$observe 'required', (value) ->
         scope.required = value
 
-      scope.$watch  'selectedItem', ->
+      scope.$watch 'selectedItem', ->
         childScope = scope.$new()
         childScope.item = scope.selectedItem
         transcludeFn childScope, (clone) ->

comp = (a, b)->
  a.toLowerCase().indexOf(b.toLowerCase()) > -1

filter = (x, xs, valueAttr)->
  if x then xs.filter ((i)-> comp(i[valueAttr], x)) else xs

        when 33 then move(-11)

    $scope.$watch 'search', search
    $scope.$watch 'limit', -> search('')

    $scope.$watch 'active', (value) ->
      window.setTimeout((()-> scrollIfNeeded(getActiveIndex())) , 0) if value
