The short solution is to put the call to sdubmitOTP in the callback that does the console log verificationid. Because that is the purpose of the callback : do something that should happen after something completed
The longer and more sustainable anwer is to use promises, use typescript, not use any and maybe learn yourself a bit more of angular and angularfire. Too much going on here imho
any: it blinds the build system and obscures errors window: DI systems were built to avoid polluting the global namespace like this function: you lose execution context
Please get rid of all three of those. Whatever this FirebasePlugin is, seek out an Angular-aware wrapper for it (like something in Ionic Native) that returns a future (such as a Promise or Observable). Return a similar future, transforming as desired, out of send (and give proper types to all method parameters and return values). Hang a then or subscribe off that, and put your “code received” logic in there. It will run once the verification operation has concluded.
Sometimes we just want to complicate ourselves and look for complicated ways
i dont know why i couldn’t see that much of ease! i feel so silly now
Thanks BTW.