0
我需要追加這種聚合物元素的index.html 我做到了,沒有問題,但問題是我 不能追加什麼是「項目」的div 我該怎麼辦這個? 我認爲該元素尚未附加到index.html頁面,因此腳本無法捕捉「items」div。如何火力結果追加到聚合物元件
<link rel="import" href="../bower_components/polymer/polymer.html">
<script src='https://cdn.firebase.com/js/client/2.2.1/firebase.js'></script>
<link rel="import" href="../bower_components/paper-icon-button">
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script>
<dom-module id="sample-page">
<style>
</style>
<template>
<div class="items">
</div>
</template>
</dom-module>
<script>
Polymer({
is: "sample-page",
});
$(document).ready(function(){
;
var rootRef = "myfirebase ref......."
rootRef.on("child_added", function (snapshot, prevChildKey) {
var pointData = snapshot.val();
snapshot.forEach(function (childSnap) {
$('#items').append(pointData.user);
var key = childSnap.key();
//console.log('here come');
// console.log("Title: " + pointData.user);
})
// });
// });
</script>