How to grab value from data-* attribute and dynamically place on element?

I’m trying to build out a page that will be easy for me to duplicate into additional pages for my app. The idea is to replace one data-* attribute value (e.g. data-page-name=“Contacts”), and have it flow through different elements on my page.

For example:

  • Contact Page
    • Contact page contains the following attribute on the HTML tag which will be used to replace all templated areas on the page
      • <html data-page-name="Contact">
    • I will have multiple templated areas on the page that I want to populate the value
      • As the head title
        • <title>Contact List</title>
      • As the Page title
        • <h3 class="nk-block-title page-title" dmx-html="">Contacts</h3>

So, what do I need to use in the “Dynamics Attributes” property on each of these elements to grab the value in the data-* attribute?

Why not just create a simple variable and bind that at various places direclty?

Thanks @sid. That was pretty easy. :slight_smile:

1.Create a variable

  1. Give it an ID and value (this will be easy to change on each duplicated page)

  2. Use it with the Dynamic Attribute on elements.