如何使用聚合物的Firebase元素清除所有数据



我使用firebase-element

<firebase-document id='user'
        location="https://bar-foo.firebaseio.com/user/qo8joqjdj"
        data="{{info}}"></firebase-document>

在firebase中,我存储了以下数据:

bar-foo: {
    user: {
       qo8joqjdj: {  
           settings: { ... }
           profile:  { ... }
           actions:  { ... }
    }
}

现在,如果用户单击按钮Remove,它的所有数据应该从firebase中删除。在firebase-element文档中有一个方法叫做remove

this.user.remove({});

然而,这不起作用,我必须承认,我不清楚到底应该是什么论点。我尝试了不同的方法,但都不起作用。

这里似乎有几件事:

  1. 您正在查看firebase-collection元素文档。您应该参考firebase-document元素文档。

  2. javascript:

    this.user.remove ({})

    没有引用现有的元素或对象,至少在你提供的html中没有。

  3. 使用提供的示例,您只需要做:

    this.info = null;

最新更新