I am trying to fetch data using a dynamic, imperatively created firebase-document
element inside a custom behavior.
I have the following code. Notice the first console.log
correctly logs as expected. But the second never logs anything. Where am I going wrong?
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/polymerfire/polymerfire.html">
...
getUserLocalSeries: function(uid) {
var doc = document.createElement('firebase-document');
var path = ['users', uid, 'local'].join('/');
doc.appName = 'app';
doc.path = path;
var _this = this;
console.log('path', path); // Logs fine
doc.addEventListener('response', function(e) {
console.log('doc', doc.lastResponse); // Doesn't log
_this.set('userLocalSeries', doc.lastResponse);
});
this.set('userLocalSeries', doc.data);
},