polymer: using a function in a data binding expression
问题 One of the properties of my Polymer element is a timestamp: Polymer({ timestamp: null, ready: function () { this.timestamp = new Date().getTime(); } }); In my markup I need to show a formatted timestamp: <template> timestamp={{getFormattedTimestamp()}} </template> where getFormattedTimestamp: function () { return new Date(this.timestamp).toLocaleString('en-US', {timeZoneName: 'short'}); } But the code above does not update the display when this.timestamp changes because Polymer does not know