I'm a bit confused about the behavior of $scope.search in this code snippet. Specifically, I don't understand what happens when it's set equal to the function. If I wanted to approach this task differently, how would I go about it?
(I'm working with AngularJS version 1.6)
$scope.search = function(){
query.get($scope.username , {
success: function(gameScore) {
console.log(gameScore);
return gameScore;
},
error: function(object, error) {
console.log("Sorry, this user does not exist yet");
}
});
};