Why will not this work ?
I am trying to use notify
and listeners
together. Am I missing something ?
Polymer({
is: 'x-child',
properties: {
message: {
type: String,
value: '',
notify: true
}
}
});
Polymer({
is: 'x-dad',
listeners: {
'message-changed': '_onMessageReceived'
},
_onMessageReceived: function (e) {
alert('child sent a message');
}
});
scenario
var d = document.createElement('x-dad');
var c = document.createElement('x-child');
d.appendChild(c);
c.message = 'new';
In devguide it writes:
https://www.polymer-project.org/1.0/docs/devguide/data-binding.html#change-notification-protocol
It means that event listeners are invoked only on the
x-child
element, but not on its ancestors. This may be what you are missing.