function with DWR Call
self.getUsers = function()
{
console.log("Get User called");
userProjectDWRManager.getAllUsers(function(list){
console.log(list);
return list;
});
}
var list = self.getUsers();
console.log(list) //undefined
I tried promise concept but I don't understand exactly how to apply it with DWR exactly.
Edit:
The whole scenario is that I am in
$transitions.onStart({
}, function(trans) {
// get list here from DWR call
if(list.length==0)
{
event.preventDefaults();
$state.go('register',{});
}
}
In this function I want to get the list and wait for the list to return before going to the next state. But it always goes to the next state.
you can pass a reference to a callback function into promise function to execute after promise resolved.
for your updated question