Here is some Typescript code that I thought would be simple.
public showDialog(theNickname: string): string {
var req = {
method: 'POST',
url: '/Q/GetUserDetails',
data: { nickname: theNickname }
}
this.$http(req).then((response) => {
var c = "Nickname: " + response.data.Nickname + "<br/>";
c = c + "Score: " + response.data.Score + "<br/>";
c = c + "Followers: " + response.data.Followers + "<br/>";
return c;
});
}
The issue is that it's not returning the string value because it is being returned as a promise. I am trying to find a solution without using a timeout function. How can I get the string value to return properly? This code is being called from an Angular function within the html.
public showDialog(theNickname: string): any {
When I change it to this, it still doesn't work. This code is specifically for use in a UI.Bootstrap Popover.
Thank you!