     replace:     true
     require:     "?ngModel"
 
-    link: ($scope, element, attrs) ->
-      labelKey      = attrs.macAutocompleteLabel       or "name"
-      queryKey      = attrs.macAutocompleteQuery       or "q"
-      delay         = +attrs.macAutocompleteDelay      or 800
+    link: ($scope, element, attrs, ctrl) ->
+      labelKey = attrs.macAutocompleteLabel  or "name"
+      queryKey = attrs.macAutocompleteQuery  or "q"
+      delay    = +attrs.macAutocompleteDelay or 800
 
       autocompleteUrl     = $parse attrs.macAutocompleteUrl
       onSelect            = $parse attrs.macAutocompleteOnSelect

      source              = $parse attrs.macAutocompleteSource
      currentAutocomplete = []

      # TODO
      if attrs.ngModel?
        $scope.$watch attrs.ngModel, (value) ->
          setTimeout ->
            element.val value
          , 0

      #


          $http(options)
            .success (data, status, headers, config) ->
                fetchedList  = onSuccess?({data, status, headers})
                fetchedList ?= data.data

                resp updateList fetchedList
            .error (data, status, headers, config) ->
              onError? {data, status, headers}
        else
          list = updateList(source($scope) or [])
          resp $filter("filter") list, req.term
