I’m trying to integrate AlpineJS in a LiveView project using Surface. I’ve tried a few different interpolation techniques but none seem to work. Here is some of the trials.
def render(assigns) do
~F"""
<div x-data="{message: 'hello world'}" x-text="message" />
"""
end
def render(assigns) do
~F"""
<div x-data={"{message: 'hello world'}"} x-text="message" />
"""
end
def render(assigns) do
~F"""
<div x-data={
"""
{message: 'hello world'}\
"""}
x-text="message" />
"""
end
But none of these work. Either nothing gets displayed or I get some compilation errors. Anyone had any luck with this?