There is this small function that should logically returns always, but I am getting undefined :-
    function hasAccess() {
            var dataObj = {
                    "id" : $scope.groupId
                };
            $http.post('http://vlinux:9099/GetItems', dataObj).then(
                    function(response) {
                        var result = response.data.result;
                            if(result.includes($scope.screenId)) {
                                return "ok";
                            } else {
                                return "nok";
                            }
                    });
        }
I started getting downvotes, so wuickly adding, I debugged it and saw http call is bringing expected response and flow is jumping to the right if/else block. Problem is when I am calling this function in a variable its storing undefined.
The call is simple too :-
    var allow = hasAccess();
 
     
    