Skip to content

Instantly share code, notes, and snippets.

@mikeymicrophone
Created January 16, 2017 23:33
Show Gist options
  • Save mikeymicrophone/42b01490b86e41aac65f9d28847958bc to your computer and use it in GitHub Desktop.
Save mikeymicrophone/42b01490b86e41aac65f9d28847958bc to your computer and use it in GitHub Desktop.
help debug double-binding of fdicCertificateNumber as selectedBankCert on line 22
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/paper-button/paper-button.html">
<link rel="import" href="shared-styles.html">
<dom-module id="matched-bank">
<template>
<style include="shared-styles">
</style>
<div class="matchedBank">
<span>[[displayedBank.name]]</span>
<span>[[displayedBank.city]], [[displayedBank.state]]</span>
<span>[[displayedBank.fdic_certificate_number]]</span>
<paper-button on-tap="_deliverCert">View Cost of Funds</paper-button>
</div>
</template>
<script>
Polymer({
is: 'matched-bank',
properties: {
'displayedBank': Object,
'selectedBankCert': {
type: String,
notify: true
}
},
_deliverCert: function() {
console.log('This log statement appears when I tap the button');
this.selectedBankCert = this.displayedBank.fdic_certificate_number;
}
})
</script>
</dom-module>
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../bower_components/iron-ajax/iron-ajax.html">
<link rel="import" href="../bower_components/paper-input/paper-input.html">
<link rel="import" href="../bower_components/paper-button/paper-button.html">
<link rel="import" href="matched-bank.html">
<link rel="import" href="shared-styles.html">
<dom-module id="salesperson-page">
<template>
<style include="shared-styles">
:host {
display: block;
}
</style>
<div class="card">
<div id="bank_selection_interface">
<paper-input id="bank_fdic_certificate_number"></paper-input>
<paper-button on-tap="loadCert">View Bank</paper-button>
</div>
</div>
<div class="card" id="bank_selector">
<template is="dom-repeat" items="[[matchedBanks]]" selected-bank-cert="{{fdicCertificateNumber}}">
<matched-bank displayed-bank="[[item]]">
</template>
</div>
<iron-ajax
id="bank_fetcher"
url="http://localhost:8000/banks/fetch/[[fdicCertificateNumber]]"
last-response="{{bank}}"
on-response="displayBanks">
</iron-ajax>
</template>
<script>
Polymer({
is: 'salesperson-page',
properties: {
bank: {
type: Object,
notify: true
},
fdicCertificateNumber: {
type: String,
notify: true
},
matchedBanks: {
type: Array,
notify: true
}
},
listeners: {
'fdic-certificate-number-changed': 'fetchBank'
},
loadCert: function() {
this.fdicCertificateNumber = this.$.bank_fdic_certificate_number.value;
},
fetchBank: function() {
console.log('However, this one does not appear');
this.$.bank_fetcher.generateRequest();
},
displayBanks: function(result) {
payload = result.detail.response;
if (payload.banks) {
this.matchedBanks = payload.banks;
console.dir(this.matchedBanks);
}
}
});
</script>
</dom-module>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment