title: ionic2 facebook login not success
body: <p>i'm trying to do login to my app with facebook,
  i installed the cordova facebook plugin </p>
  
  <p><a href="https://i.stack.imgur.com/aehn8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aehn8.jpg" alt="enter image description here"></a></p>
  
  <p>and this my code but i get error on Promise
  <a href="https://i.stack.imgur.com/gA9VS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gA9VS.png" alt="enter image description here"></a></p>
  
  <p>this is my code(actually i just copied it from tutorial that say it works for him)</p>
  
  <pre><code>import { Component } from '@angular/core';
  import { NavController,Platform } from 'ionic-angular';
  import {Http, Headers, RequestOptions} from '@angular/http';
  import 'rxjs/add/operator/map';
  
  
  declare const facebookConnectPlugin: any;
  
  @Component({
    templateUrl: 'build/pages/home/home.html',
  })
  export class HomePage {
    posts:any;
    constructor(public platform: Platform, private navCtrl: NavController,private http: Http)
    { this.platform = platform;
      this.http = http;
    }
  
    fblogin()
    {
      this.platform.ready().then(() =&gt; {
        this.fblogin1().then(success =&gt; {
          console.log("facebook data===" + success);
          alert("facebook data===" + success);
          this.http.post('http://localhost/facebook.php',success)
              .map( res =&gt;res.json()).subscribe(data =&gt; {
            if(data.msg=="fail")
            {
              console.log('Login failed');
              alert("Invalid username and password");
              return;
            }
            else
            {
              console.log(' login Sucessfully facebook');
            }
          });
        }, (error) =&gt; {
          alert(error);
        });
      });
    }
    fblogin1(): Promise&lt;any&gt;
    {
      return new Promise(function(resolve,reject)
      {
        facebookConnectPlugin.login(["email"], function(response)
            {
              alert(JSON.stringify(response.authResponse));
              facebookConnectPlugin.api('/' + response.authResponse.userID + '?fields=id,name,email,gender',[],
                  function onSuccess(result)
                  {
  //alert(JSON.stringify(result));
  //console.log(JSON.stringify(result));
                    resolve(JSON.stringify(result));
                  },
                  function onError(error)
                  {
                    alert(error);
                  }
              );
            },
            function(error)
            {
              alert(error);
            })
      });
    }
  
  }
  </code></pre>
  
  <p>if anyone know another way i would like to know.</p>