I am integrating quickblox sdk into ionic 2 app. i am not able to get json object from retrieveChatDialogs function below but in response i receive server spi response but the variable chats scope print blank object in console log. I am new to typescript 2 and angular 2 please help.
export class Quickblox {
public chats: any; dialogs: any = {};
retrieveChatDialogs() {
var _that = this;
_that.chats = _that.getdialoglist();
console.log( _that.chats);
}
getdialoglist(){
var chatdialog:any;
chatdialog = QB.chat.dialog.list(null, function (err, resDialogs) {
if (err) {
console.log(err);
chatdialog = {};
} else {
chatdialog = resDialogs.items;
}
});
console.log(chatdialog);
return chatdialog;
}
}