Reputation: 5001
EDIT - THIS IS A COMPLETE RED HERRING. One of the user
properties down the hierarchy had the readOnly
property set for user. This was preventing it propagating.
I am struggling to understand databinding and how values propagate when the property changes I have a tree structured set of elements (the structure is spread across separate element definitions - not with <content>
tags as possibly implied by the structure show below)
<my-app user="{{user}}">
<my-session user="{{user}}">
<my-login user="{{user}}"></my-login>
</my-session>
<template is="dom-if" if="[[user.name]]">
<my-pages user="{{user}}">
<iron-pages>
<my-menu user="{{user}}"></my-menu>
<my-reports user="{{user}}"></my-reports>
</iron-pages>
</my-pages>
</template>
</my-app>
Each of these elements at their different definitions define a property
user : {
type: Object,
notify: true
}
And all the elements are linked with two way data binding
<my-pages>
is lazy loaded using importHref
after the user has logged on (and therefore user.name
is defined)
I have a property of user
called keys
which is used for access control. In particular both <my-menu>
and a sub element of <my-reports>
uses this to determine which menu items to display.
This all works fine on initial log on. But if I change the logged on user, then this change to the user property is apparently not propagating properly
What I can see is that from the debugger triggered during a page change from iron pagess I can see that the <my-app>
's user
has the new logged on user value BUT <my-pages>
's user
has the old user. For some reason data binding of user
is not working down the tree structure, even though it appears to have successfully propagated up from <my-login>
to <my-app>
. .
I am assuming that possibly the "object" of user
is not changing only the paths. I am getting confused about what I should be doing here. Can someone help.
Upvotes: 0
Views: 134
Reputation: 2964
Really cannot tell what's wrong with your code with the information that you have provided except for the syntax error
where instead of closing my-pages
you have started a new one, but here's a plunker emulating your code. I was able to successfully change the user for all the elements.
Upvotes: 1