forked from SymfonyCasts/symfony-ux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearchpreview-add-url-value.diff
32 lines (31 loc) · 1.18 KB
/
searchpreview-add-url-value.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
diff --git a/assets/controllers/search-preview_controller.js b/assets/controllers/search-preview_controller.js
index b91d717..db5f97c 100644
--- a/assets/controllers/search-preview_controller.js
+++ b/assets/controllers/search-preview_controller.js
@@ -1,7 +1,11 @@
import { Controller } from 'stimulus';
export default class extends Controller {
+ static values = {
+ url: String,
+ }
+
onSearchInput(event) {
- console.log(event);
+ console.log(this.urlValue);
}
}
diff --git a/templates/product/index.html.twig b/templates/product/index.html.twig
index f52c337..3d5a68f 100644
--- a/templates/product/index.html.twig
+++ b/templates/product/index.html.twig
@@ -38,7 +38,9 @@
<form>
<div
class="input-group"
- {{ stimulus_controller('search-preview') }}
+ {{ stimulus_controller('search-preview', {
+ url: path('app_homepage')
+ }) }}
>
<input
name="q"