diff --git a/core/modules/views/src/Controller/ViewAjaxController.php b/core/modules/views/src/Controller/ViewAjaxController.php
index 54310f68df8bf91a5b03a65ecb4092fdc19e1a8c..a4a3d2538dc25c61cd7e971e51b8f4e345caf856 100644
--- a/core/modules/views/src/Controller/ViewAjaxController.php
+++ b/core/modules/views/src/Controller/ViewAjaxController.php
@@ -214,6 +214,10 @@ public function ajaxView(Request $request) {
         $response->addCommand(new PrependCommand(".js-view-dom-id-$dom_id", ['#type' => 'status_messages']));
         $request->query->set('ajax_page_state', $existing_page_state);
 
+        if (!empty($preview['#attached'])) {
+          $response->setAttachments($preview['#attached']);
+        }
+
         return $response;
       }
       else {
diff --git a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php
index aff3dc6696daa9ee5d82dded1023d2fa8518ed5b..10ec7fc29516884da82bf8722cfcaabda24c0be5 100644
--- a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php
+++ b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php
@@ -209,6 +209,14 @@ public function testAjaxView() {
     $this->assertSame($response->getView(), $executable);
 
     $this->assertViewResultCommand($response);
+
+    // Test that the ajax controller for Views contains the
+    // Drupal Settings.
+    $this->assertEquals([
+      'drupalSettings' => [
+        'testSetting' => ['Setting'],
+      ],
+    ], $response->getAttachments());
   }
 
   /**
@@ -389,7 +397,14 @@ protected function setupValidMocks($use_ajax = self::USE_AJAX) {
       ->willReturn(TRUE);
     $executable->expects($this->atMost(1))
       ->method('preview')
-      ->willReturn(['#markup' => 'View result']);
+      ->willReturn([
+        '#markup' => 'View result',
+        '#attached' => [
+          'drupalSettings' => [
+            'testSetting' => ['Setting'],
+          ],
+        ],
+      ]);
 
     $this->executableFactory->expects($this->once())
       ->method('get')