1
我试图给某些用户显示一个dom-if模板,但我不知道如何去做。这里是什么,我试图做一个伪代码:Dom-if通过用户角色与聚合物&firebase使用firebase-auth和谷歌作为提供者
<template is="dom-if" if="{{user.isAdmin}}" restamp="true">
<hr />
<h1>Add new conference:</h1>
<paper-input
id="title"
label="Título"
type="text"
name="title">
</paper-input>
<paper-fab id="saveFab" icon="cloud-upload" on-tap="add"></paper-fab>
</template>
<script>
Polymer({
is: 'my-conferences',
properties: {
data: Array,
user: Object,
},
...
其中“用户”是我从<firebase-auth>
元素得到了对象。像user.isAdmin是我想达到的。
任何想法?谢谢!
你可以发布你的代码的完整例子吗?目前,我没有看到'my-meetings'元素的'dom-module'。如果你没有它,那么这是你的问题。如果你确实有这个问题,那么问题在于其他地方,我们需要查看更多的代码才能对其进行分析。 – alesc
我有默认的聚合物元素结构(包括dom模块)。这里的所有源代码:https://github.com/zolastro/HackersWeekMalaga/blob/master/src/my-app/my-conferences.html – Zolastro
你如何认证你的管理员?您使用哪种验证类型与Firebase? 也许看看这里:http://stackoverflow.com/questions/17607101/firebase-authenticate-as-admin – Niklas