postPersonalDetails(pdData){
let options : RequestOptionsArgs;
let token:string;
let id:string;
this.getToken().then((val) => {
token = val;
console.log("I am in token func"+token);
});
this.storage.get('userID').then((val) => {
id = val;
console.log(val);
});
console.log("I amhere"+token+id);
I am getting the data in 1st consoleLog and 2nd Consolelog
Because of the asynchronous nature 3rd console log is printing first there by I am getting token is undefined and user ID is undefined What is the right way of doing this?