Skip to content

Instantly share code, notes, and snippets.

@mikeymicrophone
Last active January 5, 2017 20:01
Show Gist options
  • Save mikeymicrophone/fc0da8f7e385f7d315c99f3c871818c0 to your computer and use it in GitHub Desktop.
Save mikeymicrophone/fc0da8f7e385f7d315c99f3c871818c0 to your computer and use it in GitHub Desktop.
I'm curious how I would extend iron-ajax in Polymer - what element should I put in the template to show how I'm overriding it?
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/iron-ajax/iron-ajax.html">
<dom-module id="bankdata-ajax">
<template>
<iron-ajax
id="request_courier"
url="[[url]]"
handle-as="json"
last-response="{{resultingData}}">
</iron-ajax>
</template>
<script>
Polymer({
is: 'bankdata-ajax',
properties: {
endpointLocation: {
type: String,
notify: true
},
url: String,
bankId: {
type: String,
notify: true
},
resultingData: {
type: Object,
notify: true
}
},
listeners: {
'endpoint-location-changed': '_setUrl',
'bank-id-changed': '_setUrl'
'resulting-data-changed': '_deliverData'
},
_setUrl: function() {
base = "http://localhost:8000/banks/";
this.url = base + this.bank_id + this.endpointLocation;
this.$.request_courier.generateRequest();
},
_deliverData: function() {
// send resultingData to the template that has the bankdata-ajax
}
})
</script>
</dom-module>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment