Accessing properties of class in javascript

I might be way out and don’t understand something but i’m trying to access the value of a property in javascript and i’m getting nowhere

Here is the Code in my class (the value of PoliciesURL is set when i instantiate the class)

<string ux:Global="PolicyURL" ux:Value="https://mysite.com/terms-and-conditions" />
<Landing ux:Template="landing" router="router" PoliciesURL="PolicyURL" />
<Page ux:Class="Landing" Color="Black">
    <object ux:Property="PoliciesURL" />
    <JavaScript File="src/Landing.js"/>
    <Text Clicked="{gotoPolicies}">Terms of Use</Text>

Showing in UX works perfectly, but javascript, not so much.

This is what i’m doing in my javascript

function gotoPolicies() 
{     
    console.log(this.PoliciesURL);
}

module.exports = { gotoPolicies };

When i click i always get “null”. I’ve read many threads that show stuff like this and it works for them. What am i doing wrong?

Hi Marc,

the properties are reactive Observables. So it looks like you’re using it wrong.

We just discussed the same thing in this thread. Take a look there and see if that helps!

Hi Uldis,

Yeah that helped understand how it works. It’s kinda jarring way to work with objects/variables but works in the end.

Thanks