     @list        = angular.element("<div class='autocomplete menu'></div>")
     @filter      = $filter
     @listFactory = @element.injector().get(@factory)
+    @existing_factory = @scope[@factory] || @scope.$parent[@factory]
     @list.insertAfter(@element[0])
 
     if @parent_name

    updateView = @updateView
    if @context
      return unless @parent()
    @listFactory.index @serialize(), (data) ->
      scope[factory] = data
      updateView(model())
  updateView: (value) =>
    object              = {}
    object[@list_attr]  = value || ''

  # Private methods
  scope_assignment: (scope,arg) =>
    parent = scope
    for level in arg
      parent = parent[level] || parent.$parent[level]
    parent

angular.module('AutoComplete', [ 'FactoryName'])
