显示之前/当前提交的Firebase数据

时间:2016-09-27 03:07:40

标签: javascript firebase firebase-realtime-database

所以,我只想创建一个页面,在其中输入用户的姓名和年龄,然后他们提交,然后将其发送到Firebase数据库,这样就完美了。我试图做的另一件事是显示在"视图中提交的数据"部分。因此,只需在下方显示用户的姓名和年龄。我正在努力理解/解释为什么我的代码无效 - 我有一个h3应该被存储在我的数据库中的数据所取代。 这是我的检索部分的代码 '年龄'是一类儿童的名字(另一类是姓名')

def make_list(l, v):
    g = (x for x in l)
    if len(l) == sum(v):
       return [[next(g) for _ in range(val)] for val in v]
    return None

1 个答案:

答案 0 :(得分:1)

<script type="application/ld+json"> { "@context" : "http://schema.org", "@type" : "NewsArticle", "author" : { "@type" : "Person", "name" : "hgezim" }, "dateModified" : "2016-09-21T06:25:35+00:00", "datePublished" : "2016-09-21T06:25:35+00:00", "hasPart" : { "@context" : "http://schema.org", "@type" : "Recipe", "author" : "John Smith", "cookTime" : "PT1H", "datePublished" : "2009-05-08", "description" : "This classic banana bread recipe comes from my mom -- the walnuts add a nice texture and flavor to the banana bread.", "image" : "bananabread.jpg", "interactionStatistic" : { "@type" : "InteractionCounter", "interactionType" : "http://schema.org/Comment", "userInteractionCount" : "140" }, "name" : "Mom's World Famous Banana Bread", "nutrition" : { "@type" : "NutritionInformation", "calories" : "240 calories", "fatContent" : "9 grams fat" }, "prepTime" : "PT15M", "recipeIngredient" : [ "3 or 4 ripe bananas, smashed", "1 egg", "3/4 cup of sugar" ], "recipeInstructions" : "Preheat the oven to 350 degrees. Mix in the ingredients in a bowl. Add the flour last. Pour the mixture into a loaf pan and bake for one hour.", "recipeYield" : "1 loaf", "suitableForDiet" : "http://schema.org/LowFatDiet" }, "headline" : "Chicken Papriak", "mainEntityOfPage" : "http://localhost:8080/2016/09/21/chicken-papriak/", "publisher" : { "@type" : "Organization", "name" : "Dev Blog" } } </script> 不是.value的属性。您需要在其上调用DataSnapshot方法。

.val()

docs:https://firebase.google.com/docs/reference/js/firebase.database.DataSnapshot#val