JS syntax error when passing parameter #109
Unanswered
mkochstroer
asked this question in
Q&A
Replies: 1 comment
-
Helped myself with the following workaround
and in the mount function: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I try to pass some parameters. But with the given example I got the js error
"Uncaught (in promise) SyntaxError: missing } after property list"
And the modal dosn't open. - Without parameters it opens. Is there an error on my side?
My code
<script> document.getElementById("buttonName").onclick = function() { var data = {!! json_encode(["userid" => 1]) !!}; Livewire.emit("openModal", "user-task",data); } </script>
Tried it before with
{{ json_encode(["userid" => 1])) }}
and
var data = '{!! json_encode(["userid" => 1]) !!}';
var data = '{{ json_encode(["userid" => 1]) }}';
but same issue.
laravel
`class UserTask extends ModalComponent
{
public $userid;
}`
Stack
Uncaught (in promise) SyntaxError: missing } after property list initialize node_initializer.js:11 value index.js:92 value index.js:525 walk walk.js:5 walk walk.js:10 walk walk.js:10 value index.js:511 value index.js:90 Component index.js:51 onNodeAdded index.js:496 callHook morphdom.js:35 handleNodeAdded morphdom.js:140 handleNodeAdded morphdom.js:158 morphEl morphdom.js:407 morphEl morphdom.js:219 morphEl morphdom.js:332 morphEl morphdom.js:219 morphEl morphdom.js:332 morphEl morphdom.js:219 morphEl morphdom.js:332 morphEl morphdom.js:219 morphdomFactory morphdom.js:463 value index.js:386 value index.js:291 value index.js:269 value index.js:7 value index.js:58 promise callback*value/< index.js:53 promise callback*value index.js:51 sendMessage index.js:242 value index.js:252 later debounce.js:8 setTimeout handler*debounce/< debounce.js:12 value index.js:225 emit Store.js:55 emit Store.js:54 value index.js:58 <anonymous> 1:267 EventHandlerNonNull* 1:265
Beta Was this translation helpful? Give feedback.
All reactions