Home global variables typescript not defined
Reply: 0

global variables typescript not defined

user920
1#
user920 Published in July 23, 2018, 1:16 pm

I have a problem with typescript global variable.

I'm writing a piece of code to login with facebook in my ionic 3 app.

I have a global variable declared, but when the app runs, got me the error *.*FB is not defined** at the function FB.init({})

The code:

//all needed imports

declare const FB;

@Injectable()
export class AuthenticationProvider implements OnInit{

  //properties

  //constructor

   ngOnInit() {
     debugger
     if( FB != null && FB != 'undefined')
     {
       FB.init({
         appId: '***',
         cookie: false,access
         status: true,
         xfbml: true,
         version: 'v2.11'
       });
     }
   }

   //FB.login(){} inside an observable function
   //FB.getLoginStatus(){} inside an observable function
   //FB.api(){} inside an observable function

 }

Can someone help me?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.310154 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO