       source              = $parse attrs.macAutocompleteSource
       currentAutocomplete = []
 
-      # TODO
-      if attrs.ngModel?
+      # HACK: setTimeout is added to make sure value wont' change afterwards
+      if ctrl?
         $scope.$watch attrs.ngModel, (value) ->
           setTimeout ->
-            element.val value
+            ctrl.$setViewValue value
+            ctrl.$render()
           , 0
 
       #

      # @description
      # Resetting autocomplete
      #
      reset = ->
        currentAutocomplete = []

      #
      # @function

    replace:     true
    require:     "?ngModel"

    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
