删除后Firebase数据仍然存在

时间:2019-11-20 23:02:15

标签: javascript angular firebase ionic-framework firebase-realtime-database

因此,我正在使用Firebase,并且在每个用户对象中,我还保留了他的收藏夹。结构如下: enter image description here

正如您在收藏夹对象中看到的那样,我只有一条记录,我有2条记录,但是我从Firebase控制台中手动删除了一条记录。

问题在于,在我的应用程序中它仍然显示2条记录。

enter image description here

我正在使用Ionic和Angular Fire软件包。

this.userService.getUser(this.loggedUser.uid).take(1).subscribe(user => {
  console.log('count', user[0].favorites.length); //2
  for (let i = 0; i < user[0].favorites.length; i++) {
    this.userService.getUserByKey(user[0].favorites[i]).subscribe(favorite => {
      this.businesses.push(favorite);
    })
  }
});

1 个答案:

答案 0 :(得分:0)

由于take(1),您没有被订阅,将其删除,您将被订阅,因此,如果您从Firebase控制台中删除记录,该记录将从用户界面中消失

message = """To: Abc Cohen <abc.cohen@email.com> Cc: <braggis.mathew@nomail.com>,<samanth.castillo@email.com> Hi 
Abc, I happened to see your report. I have not seen any abnormalities and thus I don't think we 
should proceed to Braggis. I am open to your thought as well. Regards, Abc On Tue 23 Jul 2017 07:22"""

no_wds = ["No","don't","Can't","Not"]
yes_wds = ["Proceed","Approve","May go ahead"]

splittedMessage = message.split( ' ' )
msg = []
for i in range( 0, len( splittedMessage ) ):
   temp = splittedMessage[i]
   for j, k in zip( no_wds, yes_wds ):
       tempJ = j.lower()
       tempK = k.lower()
       if( tempJ == temp or tempK == temp ):
           msg.append( i )

found = ' '.join( splittedMessage[msg[0]:msg[1]] )
print( found )
相关问题