diff --git a/dynamic_entity_reference.routing.yml b/dynamic_entity_reference.routing.yml
index e5b9963..96304e5 100644
--- a/dynamic_entity_reference.routing.yml
+++ b/dynamic_entity_reference.routing.yml
@@ -1,6 +1,7 @@
 dynamic_entity_reference.autocomplete:
-  path: '/dynamic_entity_reference/autocomplete/{field_name}/{entity_type}/{bundle_name}/{target_type}'
+  path: '/dynamic_entity_reference/autocomplete/{field_name}/{entity_type}/{bundle_name}/{target_type}/{entity_id}'
   defaults:
     _controller: '\Drupal\dynamic_entity_reference\DynamicEntityReferenceController::handleAutocomplete'
+    entity_id: 'NULL'
   requirements:
     _access: 'TRUE'
diff --git a/js/dynamic-entity-reference-widget.js b/js/dynamic-entity-reference-widget.js
index cbb6237..b3e246b 100644
--- a/js/dynamic-entity-reference-widget.js
+++ b/js/dynamic-entity-reference-widget.js
@@ -16,16 +16,34 @@
           var $select = $(this);
           var $autocomplete = $select.parents('.container-inline').find('.form-autocomplete');
           var basePath;
+          var entityId = $autocomplete.data('entity-id');
           if (!(basePath = $autocomplete.data('base-autocomplete-path'))) {
             // This is the first time this has run, copy the default value.
-            basePath = $autocomplete.attr('data-autocomplete-path');
-            // By default, the base path contains the default suffix, so cut
-            // that off.
-            basePath = basePath.substring(0, basePath.lastIndexOf('/') + 1);
+            var autocompletePath = $autocomplete.attr('data-autocomplete-path');
+            entityId = autocompletePath.substring(autocompletePath.lastIndexOf('/') + 1, autocompletePath.length);
+            if ($.isNumeric(entityId)) {
+              // By default, the base path contains the default suffix, so cut
+              // that off.
+              basePath = autocompletePath.substring(0, autocompletePath.lastIndexOf('/'));
+              basePath = basePath.substring(0, basePath.lastIndexOf('/') + 1);
+
+            }
+            else {
+              entityId = null;
+              // By default, the base path contains the default suffix, so cut
+              // that off.
+              basePath = autocompletePath.substring(0, autocompletePath.lastIndexOf('/') + 1);
+            }
             // Store for subsequent calls.
             $autocomplete.data('base-autocomplete-path', basePath);
+            $autocomplete.data('entity-id', entityId);
+          }
+          if (entityId) {
+            $autocomplete.attr('data-autocomplete-path', basePath + $select.val() + '/' + entityId);
+          }
+          else {
+            $autocomplete.attr('data-autocomplete-path', basePath + $select.val());
           }
-          $autocomplete.attr('data-autocomplete-path', basePath + $select.val());
         });
         $selects.change();
       }
diff --git a/src/DynamicEntityReferenceController.php b/src/DynamicEntityReferenceController.php
index 0a7307a..98f54ac 100644
--- a/src/DynamicEntityReferenceController.php
+++ b/src/DynamicEntityReferenceController.php
@@ -61,11 +61,14 @@ class DynamicEntityReferenceController extends ControllerBase {
    *   The bundle name.
    * @param string $target_type
    *   The target entity type ID to search for results.
+   * @param string $entity_id
+   *   (optional) The entity ID the entity reference field is attached to.
+   *   Defaults to ''.
    *
    * @return \Symfony\Component\HttpFoundation\JsonResponse
    *   The matched labels as json.
    */
-  public function handleAutocomplete(Request $request, $field_name, $entity_type, $bundle_name, $target_type) {
+  public function handleAutocomplete(Request $request, $field_name, $entity_type, $bundle_name, $target_type, $entity_id) {
     $definitions = $this->entityManager()->getFieldDefinitions($entity_type, $bundle_name);
 
     if (!isset($definitions[$field_name])) {
@@ -96,7 +99,7 @@ class DynamicEntityReferenceController extends ControllerBase {
     $items_typed = Tags::explode($items_typed);
     $last_item = Unicode::strtolower(array_pop($items_typed));
 
-    $matches = $this->entityReferenceAutocomplete->getMatches($field_definition, $entity_type, $bundle_name, 'NULL', '', $last_item);
+    $matches = $this->entityReferenceAutocomplete->getMatches($field_definition, $entity_type, $bundle_name, $entity_id, '', $last_item);
 
     return new JsonResponse($matches);
   }
diff --git a/src/Plugin/Field/FieldWidget/DynamicEntityReferenceWidget.php b/src/Plugin/Field/FieldWidget/DynamicEntityReferenceWidget.php
index 22c30cc..e191c5a 100644
--- a/src/Plugin/Field/FieldWidget/DynamicEntityReferenceWidget.php
+++ b/src/Plugin/Field/FieldWidget/DynamicEntityReferenceWidget.php
@@ -45,6 +45,10 @@ class DynamicEntityReferenceWidget extends AutocompleteWidget {
       'target_type' => $items->get($delta)->target_type ?: key($available),
     );
 
+    if ($entity_id = $entity->id()) {
+      $autocomplete_route_parameters['entity_id'] = $entity_id;
+    }
+
     $element += array(
       '#type' => 'textfield',
       '#maxlength' => 1024,
