Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

how to dynamically change data-attribute? for example data-off-right="${model.value1}", here i want "right" should be dynamic. how can i achieve this?

Avatar

Avatar
Validate 1
Level 1
karthick1356
Level 1

Likes

0 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
karthick1356
Level 1

Likes

0 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
karthick1356
Level 1

11-06-2021

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
Level 3
kchaurasiya
Level 3

Likes

32 likes

Total Posts

33 posts

Correct Reply

6 solutions
Top badges earned
Establish
View profile

Avatar
Establish
Level 3
kchaurasiya
Level 3

Likes

32 likes

Total Posts

33 posts

Correct Reply

6 solutions
Top badges earned
Establish
View profile
kchaurasiya
Level 3

11-06-2021

Hi Karthick1356,

 

Have you tried in this way 

<sly data-sly-test.right=${right.value} />

 data-off-${right}="${model.value1}"

Answers (1)

Answers (1)

Avatar

Avatar
Boost 5
Level 5
Ritesh_M
Level 5

Likes

101 likes

Total Posts

85 posts

Correct Reply

26 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 1
View profile

Avatar
Boost 5
Level 5
Ritesh_M
Level 5

Likes

101 likes

Total Posts

85 posts

Correct Reply

26 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 1
View profile
Ritesh_M
Level 5

11-06-2021

Hi @karthick1356 ,

 

You can use 'data-sly-attribute' HTL block to achieve this. its supports map (key-value), and the key automatically becomes atribute in html mark-up.

Reference -

https://experienceleague.adobe.com/docs/experience-manager-htl/using/htl/block-statements.html?lang=...

https://www.youtube.com/watch?v=LhvSNVagoZk