I'm trying to use Polymerfire's firebase-query to retrieve a list of children for each ID in an array. I have and array with three ID's and a firebase-query that looks like:
<firebase-query id="teamContacts"
path= "{{teamConPath}}"
data="{{teamConData}}"></firebase-query>
and a couple observers that look like:
teamConData: {
observer: '_teamConDataChanged'
},
teamConPath: {
value: '',
observer: '_teamConPathChanged'
},
_teamConPathChanged: function(newValue, oldValue) {
var self = this;
if (!app.isEmpty(newValue)) {
this.$.teamContacts.getStoredValue(newValue).then((response) => {
// self.teamConData = value;
console.log('in the gsv then');
});
console.log('teamConData: ', this.teamConData);
}
},
_teamConDataChanged: function(newValue, oldValue) {
console.log('teamConChanged', newValue);
},
Initially the path to teamContacts
is null. After I set the path I don't understand how to get and work with the data. The Firebase documentation shows a method called getStoredValue()
but that method doesn't seem to be present in the firebase-query source on Github. I thought setting a new path would fetch the data and trigger the observer for the data but that doesn't seem to be the case. How can I get the firebase-query to re-query with the new path and then asynchronously work with the data?