Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 229470

Firing asynchronous functions from services

$
0
0

I've only had a quick look and it's late here so excuse any mistakes, but you might need to use a Promise instead, e.g:

  checkMail(mail){
    return new Promise((resolve, reject) => {

      var email = new Parse.Query(Parse.User);
      email.equalTo("email", mail);
      email.find({
        success: function (email) {
          if (email.length) {
            resolve(true);
          } else {
            resolve(false);
          }
        }
      });

    });
  }

  onSignup(event) {

    this.global.checkMail(this.signupForm.controls.email.value).then((result) => {
      console.log(result);
    });

  }

Viewing all articles
Browse latest Browse all 229470

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>