The check() is called from the html, and the return value should be true/false.
ng-class="{'timeline-inverted: check(id)'}"
The $scope.server.get()
get result(r)
from the server script, and I need to return the $scope.result
to the check()
function.
Here is my code in angular:
$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 undefined
});