I'm trying to push data to Firebase using Polymerfire and the Polymer App Toolbox template:
my-app.html
contains a configured<firebase-app>
component.my-models.html
(which is a page configured inmy-app.html
routes) contains a<add-model>
component<add-model>
is a form with a<firebase-query>
,<firebase-auth>
, input, and submit button.I attempt to push data using
<firebase-query>
with the following function in theadd-model.html
Polymer
object:Polymer({ is: 'add-model', properties: { data: { type: Object } }, create: function() { this.$.query.ref.push({ name: this.$.myModelName.value }); } });
Outcome
Calling
push
on the<firebase-query>
object inadd-model.html
returnsCannot read property 'push' of undefined
(explained in this Q/A, in our case it's because<firebase-app>
does not appear to be properly declared).- Moving
<firebase-app>
frommy-app.html
toadd-model.html
file does make thepush
function work, but thenmy-app.html
loses its Firebase functionality. - Calling
<firebase-app>
in both my-app.html and add-model.html returnsUncaught Error: Firebase App named 'firebase-app' already exists.
<firebase-auth>
does work inadd-model.html
and returns a[[user]]
object.
How do I make firebase-query
properly communicate with firebase-app
from my route?