javascript - Listener method inside auto-binding template? (Polymer 1.0) -


<template is="dom-bind">     <custom-element></custom-element>     <iron-ajax auto url="data.json" handle-as="json" last-response="{{data}}" on-response="receivedresponse"></iron-ajax> </template> 

in example above "custom-element" needs know when iron-ajax has received response. problem don't know put "receivedresponse" method. how do this? prefer put inside "custom-element", don't know how bind "on-response" event of iron-ajax.

i bind "{{data}}" property of "custom-element" , have observer property, feels hack , i'd find out correct way of doing this.

assign id auto-binding template ease of access

<tempalte id="app" is="dom-bind"> 

then init template in javascript

var app = document.queryselector('#app'); 

and create function.

app.receivedresponse = function () {   // process response } 

in cases need wait polymer elements stamped dom wait 'dom-change' event

app.addeventlistener('dom-change', function () {   // dom ready work }); 

hope helps...


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -