firebase - How to wait value in Ionic 2 -
i'm trying wait value may change after execute "this.bookmarlist.take(1).subscribe(..."
my problem when run application, execute second if statement "if(found==false)" before execute subscribe.
this code may found thing wrong or need add additions solve problem.
let loader = this.loadingctrl.create({ content: "", }); let found=false; loader.present().then(()=>{ this.bookmarklist.take(1).subscribe(data=>{ data.foreach(b=>{ if(b.nid==this.appservice.id && b.url==url){ let alert = this.alertctrl.create({ title: 'already bookmarked', subtitle: 'this note image bookmarked', buttons: ['ok'] }); alert.present(); found=true; } }) }) }).then(()=>{ if(found==false){ this.afd.list('/bookmark/').push({ uemail: this.userservice.email, nid: this.appservice.id, url: url, date: datex }); let alert = this.alertctrl.create({ title: 'bookmarked successfully', subtitle: 'this note image has been bookmarked successfully', buttons: ['ok'] }); alert.present(); } }).then(_=>{ loader.dismiss(); })
i find solution
let loader = this.loadingctrl.create({ content: "", }); let found=false; loader.present().then(_=>{ this.bookmarklist.take(1).subscribe(data=>{ data.foreach(b=>{ if(b.nid==this.appservice.id && b.url==url){ let alert = this.alertctrl.create({ title: 'already bookmarked', subtitle: 'this note image bookmarked', buttons: ['ok'] }); alert.present(); found=true; } }) if(found==false){ this.afd.list('/bookmark/').push({ uemail: this.userservice.email, nid: this.appservice.id, url: url, date: datex }); let alert = this.alertctrl.create({ title: 'bookmarked successfully', subtitle: 'this note image has been bookmarked successfully', buttons: ['ok'] }); alert.present(); } //return }) }).then(_=>{ loader.dismiss(); })
wiki
ReplyDeleteIf you need any assistance during registration or activation of your pogo account, then contact the Pogo Support Number on 1-833-442-7444 pogo support number . It is acceptable to encounter with some unknown error while signing-up for an account, therefore we have brought to you this Telephone number, which will directly connect you with the Pogo Support and get you necessary help. For More Info>>> pogo games not loading