When the html calls check(), it should return either true or false.
ng-class="{'timeline-inverted: check(id)'}"
The server script's $scope.server.get() retrieves a result(r) from the server, which needs to be returned to the check() function as $scope.result.
Below is my Angular code:
$scope.check = _.memoize(function(userId) {
$scope.server.get({
action: 'checkif',
userID: userId
}).then(function successHandler(r) {
$scope.result = r.data.result;
});
return $scope.result; // $scope.result is currently undefined
});