You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From the Polymer dom-if docs on Data Binding Helper Elements, (btw, the <script> tags should be placed outside and after the <dom-module>)
<dom-moduleid="user-page"><template>
All users will see this:
<div>{{user.name}}</div><templateis="dom-if"if="{{user.isAdmin}}">
Only admins will see this.
<div>{{user.secretAdminStuff}}</div></template></template><script>
Polymer({is: 'user-page',properties: {user: Object}});
</script></dom-module>
I can't seem to get this to work. Consider the following,
<!doctypehtml><html><head><title></title><metacharset="utf-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge,chrome=1"><metaname="viewport"content="width=device-width, initial-scale=1.0, maximum-scale=1.0"><scriptsrc="/bower_components/webcomponentsjs/webcomponents-lite.min.js"></script><linkrel="import"href="/elements/test-pages.html"></head><bodyclass="fullbleed"><test-pages></test-pages><script>
var app = {};
document.addEventListener("WebComponentsReady", function (e) {app=document.querySelector("test-pages");// These do not work:app.pages.page1=true;app.pages.page2=true;// However, this works:app.page3=true;});
</script></body></html>
It seems that dom-if cannot be bounded to an object's boolean property? (or am I misunderstanding something?)
Thanks so much,
Jason
The text was updated successfully, but these errors were encountered:
The dom-if doesn't get notified that the value has changed, because you're changing it imperatively. Polymer creates accessor methods for direct properties (like page3), so it can monitor changes. But subproperties are different. See:
Thank you for taking the time to concisely point this out to me. Really love what you guys are doing with Polymer - seems like you folks don't sleep at all!
Hi,
From the Polymer
dom-if
docs on Data Binding Helper Elements, (btw, the<script>
tags should be placed outside and after the<dom-module>
)I can't seem to get this to work. Consider the following,
test-pages.html
index.html
It seems that
dom-if
cannot be bounded to an object's boolean property? (or am I misunderstanding something?)Thanks so much,
Jason
The text was updated successfully, but these errors were encountered: