Hi all,
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?