How to add {{parameter}} in the iron-ajax 'url' property?

4,561 views
Skip to first unread message

Christian Tzolov

unread,
May 18, 2015, 4:00:13 AM5/18/15
to polym...@googlegroups.com
The core-ajax element allows binding parameters in the url property: 

<core-ajax url="{{hostname}}/hawq-api/v1/version" handleAs="json" response="{{resp}}"></core-ajax>

In iron-ajax this is not possible anymore. It seems that iron-ajax's url expect a static string. Is there a new way to compose dynamic urls in iron-ajax?

Thanks

jim.j...@gmail.com

unread,
May 18, 2015, 8:54:23 AM5/18/15
to polym...@googlegroups.com

Chuck Horton

unread,
May 18, 2015, 6:22:48 PM5/18/15
to polym...@googlegroups.com


<iron-ajax id="get_file"
     
handle-as="text"
     
last-response="{{fileContent}}"
     
headers='{"accept": "application/vnd.github.VERSION.html"}'
     
on-response="handleFile"
     
on-error="handleFileErrorResponse">
</iron-ajax>


ready: function() {
     this.$.get_file.url = "https://api.github.com/repos/" + this.owner + "/" + this.repo + "/contents/" + this.fileName + "?ref=" + this.branch + "&access_token=" + this.tk;
     this.$.get_file.generateRequest();
},


This works for m.
Reply all
Reply to author
Forward
0 new messages