Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/server-data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ Fetch this in JavaScript:
const user = JSON.parse(userRating.dataset.user);
There is no size limit for the value of the ``data-*`` attributes, so you can
store any content. In Twig, use the ``html_attr`` escaping strategy to avoid messing
store any content. In Twig, use the ``html`` escaping strategy to avoid messing
with HTML attributes. For example, if your ``User`` object has some ``getProfileData()``
method that returns an array, you could do the following:

.. code-block:: html+twig

<div data-user-profile="{{ app.user ? app.user.profileData|json_encode|e('html_attr') }}">
<div data-user-profile="{{ app.user ? app.user.profileData|json_encode|e('html') }}">
<!-- ... -->
</div>

Expand Down