Access properties of of component from another view?

Hi,
I am trying to link a property which is present in my header view, to one of my components in another view. Is this possible to do? When I try and browse the available properties, I am only seeing properties pertaining to all components that are within my current view, and not the header view.

Any help would be appreciated!

Thanks.

If you want to share data across views, you really need to use session properties. I don't believe that views know about each other at all.

Hi,
So how can I get the path of the property to bind to my session prop? For example, if I want to create a custom session prop called "label_value", what would the path be if I am trying to bind the value located in "./Header.header.root.label.value"?

Views/Components only have insight into the properties of the following areas:

  • Components within the same View (NOT child views)
  • Session
  • Page

If you need access to a property in a different view, then by definition that property should be scoped differently.

While examining the Session Properties in the Designer, scroll down to the Custom area at the bottom and add your new property: label_value. Don't forget to add a default value. I also recommend a more concise name as this label apparently means something very specific to the session and you won't want to have questions about it later.

When binding, you'll bind against this.session.custom.label_value.

And you don't bind the session prop to the view's label. You bind from the label to the session prop, bidirectionally, if necessary. Do this in both views.

Hi,
I think I understand but I am not sure how to write the value from my label to the session prop.

So my label inside my header has a value: "Hello".

How do I go about binding this to my session prop? Once I bind to "this.session.custom.my_label" the label inside my header turns to null.

I think I am missing something simple.

Did you make the binding bidirectional?
If you don't then the label just displays the session property.
If you do then setting the label will update the session property.

Thanks guys, I got it. I just need to set the binding to bi-directional, and also have a default value in my session props.

Much appreciate everyone's support!